MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / test_network_binding

Function test_network_binding

tests/security/test_access_control.py:98–123  ·  view source on GitHub ↗

Test network binding restrictions

(tester)

Source from the content-addressed store, hash-verified

96
97
98def 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
126def test_origin_validation(tester):

Callers 1

mainFunction · 0.85

Calls 3

SerialStudioClientClass · 0.90
commandMethod · 0.80
log_vulnerabilityMethod · 0.45

Tested by

no test coverage detected