Test network binding restrictions
(tester)
| 96 | |
| 97 | |
| 98 | def test_network_binding(tester): |
| 99 | """Test network binding restrictions""" |
| 100 | print("\n[*] Testing network binding...") |
| 101 | |
| 102 | # Test 1: Check if bound to localhost only |
| 103 | print(" - Checking bind address...") |
| 104 | try: |
| 105 | # Try to connect from localhost |
| 106 | with SerialStudioClient("127.0.0.1", 7777) as client: |
| 107 | client.command("api.getCommands") |
| 108 | print(" Accessible from 127.0.0.1 (localhost)") |
| 109 | |
| 110 | # Try to connect from 0.0.0.0 (would work if bound to all interfaces) |
| 111 | try: |
| 112 | with SerialStudioClient("0.0.0.0", 7777) as client: |
| 113 | client.command("api.getCommands") |
| 114 | tester.log_vulnerability( |
| 115 | "CRITICAL", |
| 116 | "Network Exposure", |
| 117 | "API accessible from all network interfaces (0.0.0.0)", |
| 118 | ) |
| 119 | except: |
| 120 | print(" Not accessible from 0.0.0.0 (GOOD)") |
| 121 | |
| 122 | except Exception as e: |
| 123 | print(f" Error: {e}") |
| 124 | |
| 125 | |
| 126 | def test_origin_validation(tester): |
no test coverage detected