Kamailio Configuration Reference
April 21, 2026 ยท View on GitHub
Role In Scenario
Kamailio is the public SIP edge for pbx1. It accepts SIP over UDP, TCP, TLS, WS, and WSS, proxies signaling to Asterisk, controls rtpengine, and owns several of the lab's intentionally vulnerable behaviors.
- public SIP on
5060/UDPand5060/TCP - SIP/TLS on
5061/TCP - SIP-over-WebSocket on
8000/TCP - SIP-over-secure-WebSocket on
8443/TCP rtpenginecontrol via the NG protocol over UDP on127.0.0.1:2223- MySQL logging to the
useragentsdatabase - bootstrap of the
useragentsschema and seeded fakecustomersdata inbuild/kamailio/run.sh
Key Files
| File | Purpose |
|---|---|
build/kamailio/config/kamailio.cfg | main routing logic and intentional vulnerabilities |
build/kamailio/config/tls.cfg | TLS settings for SIP/TLS and WSS |
build/kamailio/run.sh | runtime templating for public IPs, ports, and aliases |
compose/pbx1.yml | service wiring, health check, and environment |
Intentionally Vulnerable Behavior
ALLOWED_EXTENSIONSis used to return404for unknown extensions and different responses for valid ones, enabling extension enumeration- extension
2000only authenticatesREGISTER, which supports the digest-leak exercise - extension
2000registrations are only accepted from loopback - SIP
User-Agentheaders are inserted into MySQL without sanitization, enabling SQL injection - the same logged
User-Agentdata is later rendered in the web UI, enabling XSS - there is no active SIP request throttling in the routing logic, which supports SIP flood exercises
Scenario-Specific Notes
Extension Handling
- valid extensions are
sipcaller1,2000,1000,1100,1200, and1300 2000is the special digest-leak target1300is the call-generator target used for RTP bleed exercises
Dialog Handling For 2000
Kamailio tracks dialog state for calls to 2000 so in-dialog requests can be routed back to the registered helper and then back to the original caller, which keeps the digest-leak scenario reproducible.
Verification
./scripts/compose.sh --scenario pbx1 run --rm testing dvrtc-checks enum --host 127.0.0.1 --extension 2000
./scripts/compose.sh --scenario pbx1 run --rm testing dvrtc-checks digestleak-registered --host 127.0.0.1
./scripts/compose.sh --scenario pbx1 run --rm testing sqli --host 127.0.0.1 --extension 1000
./scripts/compose.sh --scenario pbx1 run --rm testing xss --host 127.0.0.1 --extension 1000
./scripts/compose.sh --scenario pbx1 run --rm testing dvrtc-checks sip-transport --host 127.0.0.1
./scripts/compose.sh --scenario pbx1 logs kamailio