Skip to content

Add drda module for IBM DB2 / DRDA database servers#748

Open
Seanstoppable wants to merge 5 commits into
zmap:masterfrom
Seanstoppable:smithsean/drda-module
Open

Add drda module for IBM DB2 / DRDA database servers#748
Seanstoppable wants to merge 5 commits into
zmap:masterfrom
Seanstoppable:smithsean/drda-module

Conversation

@Seanstoppable

Copy link
Copy Markdown
Contributor

This PR was generated with the assistance of GitHub Copilot CLI and may require human review.

Summary

Adds a new drda scan module that probes DRDA (Distributed Relational Database Architecture) database servers on TCP port 50000. DRDA is the wire protocol spoken by IBM DB2 (and Apache Derby / Informix).

The module sends a DRDA EXCSAT ("Exchange Server Attributes") request and parses the EXCSATRD reply, decoding the EBCDIC-encoded attributes into structured JSON. This mirrors the data surfaced by Shodan and nmap's drda-info script.

Example against a live DB2 11.1 server:

{"protocol":"drda","port":50000,"result":{
  "server_class":"QDB2/NT64","instance_name":"DB2",
  "release_level":"SQL11013","version":"11.01.3",
  "external_name":"DB2     db2sysc ...%FED%Y00"}}

Run it: echo <ip> | zgrab2 drda --port 50000

Output fields

Field DRDA attr Example
server_class SRVCLSNM QDB2/NT64
instance_name SRVNAM DB2
release_level SRVRLSLV SQL11013
version derived 11.01.3
external_name EXTNAM DB2 db2sysc ...
product_id PRDID (when present)

Changes

  • modules/drda/ — scanner, DRDA packet build/parse, EBCDIC decoding, unit + live tests
  • modules/drda.go — module registration
  • zgrab2_schemas/zgrab2/drda.py — output schema (registered in __init__.py)
  • integration_tests/drda/ — a minimal mock DRDA server container + test.sh

Testing

  • Unit tests: go test ./modules/drda/ — pass
  • gofmt / go vet — clean
  • Integration test runs end-to-end through Docker against the mock server and passes; output validates against the new schema
  • Verified against a real Internet-facing IBM DB2 11.1 server; output matches Shodan and nmap --script drda-info

Seanstoppable and others added 5 commits July 6, 2026 13:15
Adds a new `drda` scan module that probes DRDA (Distributed Relational
Database Architecture) database servers on TCP port 50000. DRDA is spoken by
IBM DB2 (and Apache Derby / Informix).

The module sends a DRDA EXCSAT ("Exchange Server Attributes") request and
parses the EXCSATRD reply, decoding the EBCDIC-encoded attributes into
structured output: server class / platform (e.g. QDB2/NT64), instance name,
product release level (e.g. SQL11013), a human-readable version (11.01.3),
and external name. This mirrors the data surfaced by Shodan and nmap's
drda-info script.

Includes:
- modules/drda: scanner, DRDA packet build/parse, EBCDIC decoding, unit tests
- zgrab2_schemas/zgrab2/drda.py: output schema
- integration_tests/drda: mock DRDA server container + test.sh

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The drda module parses untrusted binary input (binary.BigEndian, io.ReadFull),
so scripts/check-fuzz-coverage.sh requires a fuzz test. Add FuzzParseEXCSATRD
covering parseEXCSATRD with real, minimal, and adversarial (short buffers, bad
magic, lying length prefixes, overrunning parameters) seed inputs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- golangci-lint (prealloc): preallocate DDM buffer capacity in buildEXCSAT
  and the test helper so the trailing append does not reallocate.
- black: reformat drda.py schema and mock server.py to satisfy the Python
  formatter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the mock DRDA server container and docker-compose wiring. The module's
unit tests (drda_test.go) and fuzz test already cover the DRDA build/parse
logic, matching the convention of other binary-protocol modules (e.g. modbus,
oracle, siemens) that ship without an integration test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Complete the integration-test removal: drop the drda service block and
drda-network that referenced the now-deleted ./drda/container context.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Seanstoppable Seanstoppable marked this pull request as ready for review July 6, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant