External defence of five vulnerable services
First place in round 2 of the CyberSecurity Uzum Hackathon. Five intentionally vulnerable services had to be closed from the outside, without touching application code and without breaking legitimate clients.
- Period
- 24–25 October 2026
- Role
- Team lead, team Vanking
- Stack
- Python, mitmproxy, SafeLine WAF, Modbus/TCP, SBE, unittest, ruff, mypy
- place, round 2
- 1
- points
- 38
- SLA
- 98%
- items closed
- 32/52
The task
The defensive track gave each team five intentionally vulnerable services: a bank with Active Directory, a marketplace, a corporate portal, a parcel locker network and an agricultural plant controller. The rules allowed only external protection. Application code stayed as it was, and every rule we added was scored twice: for the attacks it stopped and for the legitimate clients it kept working, measured as SLA.
That constraint decides the design. A rule that blocks an attack and also blocks a customer loses points, so every rule had to be proven against real traffic before it went live.
Result
ClosedLeft open
- Sovereign VaultClosed 10/14
- MarketClosed 5/15
- Nether CorpClosed 3/5
- OffLockerClosed 6/8
- AgroPlantClosed 8/10
Closed32/52
- 13:00
- Place2
- 16:00
- Place1
38points+3
At the 13:00 checkpoint of the final day we were second. By 16:00 we finished first with 38 points, three ahead of the next team, with the highest SLA on the board.
(Open image)Approach: allowlist the structure
A signature WAF closes injections. It does not close business logic: a negative transfer amount, someone else’s parcel locker, a pump switched on with the valve shut. Those requests look perfectly valid to a signature. They are only caught by rules that understand the protocol and the state behind it, so we described what a correct request looks like and rejected everything else.
| Component | Protects | How |
|---|---|---|
| web/ | Vault, Market, Nether | Policy and mitmproxy addon behind SafeLine: allowlist of JSON fields, amount checks, JWT algorithm, Host/Origin, internal endpoints, upload extensions. |
| offlocker/ | OffLocker | SBE gateway: frame allowlist, URL/XML/path/signature checks, locker ownership verified through MyParcels, PIN login pacing, a protocol-level error reply instead of dropping the connection. |
| agro/ | AgroPlant | Modbus/TCP gateway: structural allowlist, FC22 read-modify-write under a lock, pump water path, dosing limits, rate rules, telemetry reads outside the write lock. |
Proving nothing breaks
- legitimate HTTP requests replayed and allowed
- 27 598
- Modbus responses matched byte for byte
- 384
- unit, transport and integration tests
- 66
- Allowed
- 27 598
- Denied
- 336
- The web policy was replayed against a traffic capture: 27,598 legitimate requests allowed, 336 denied.
- The Modbus gateway was checked on the 69 requests documented in the plant manual; all 384 responses matched byte for byte.
- A smoke script walks the standard client scenarios and reports PASS, FAIL, CONF, SKIP or SLOW for each.
- Disputed rules sit behind flags, so a rule that turns out too strict is rolled back in seconds.
Defects we found in our own build
Before the final build we reviewed our own gateways and fixed twelve defects, each with a regression test. Three of them:
- The dosing counter grew even when the backend rejected the pulse: two rejected 1000 ml requests were counted as 2000 ml with nothing actually dosed. Now a pulse counts only after a successful acknowledgement.
- Eight parallel PIN attempts received the same one-second wait and passed together. Login slots are now sequential and the queue is bounded.
- Any policy denial closed the OffLocker TCP connection without a reply, which legitimate clients saw as an outage. The gateway now answers with a protocol error and keeps the session.
What stayed open
Market is our weakest result, 5 of 15. Logic that depends on knowing who owns an object — IDOR, the payment callback, the cart — cannot be closed from outside the application. The same goes for AD, FTP and SSH, which were not behind our gateways. These items are recorded as a backlog for the product owner instead of being presented as solved.
The repository keeps a register of 50 findings that separates what is confirmed, what is partial and what needs changes in product code. All stand addresses are replaced with a placeholder and the package contains no secrets.