Conversation
pr summary4 files changed (+197 -0)
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #275 +/- ##
==========================================
+ Coverage 64.93% 68.67% +3.74%
==========================================
Files 88 89 +1
Lines 7908 8913 +1005
==========================================
+ Hits 5135 6121 +986
- Misses 2379 2388 +9
- Partials 394 404 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vmfunc
left a comment
There was a problem hiding this comment.
panels are good, the two-class and-condition on each is specific enough that a generic 200 won't trip them.
the api module i want to hold on. line 27, the header matcher requires the response content-type to contain application/json-rpc. pretty sure that's the request content-type, not the response... real zabbix api_jsonrpc.php answers apiinfo.version with Content-Type: application/json. if that's right, since matchers are and'd this never fires against a live instance and the module is dead. the test doesn't catch it because it hardcodes application/json-rpc on the mock, so it's just asserting the module's own assumption back at itself.
verify against a real zabbix (any 6.x/7.x). if it comes back application/json like i think, either drop the header matcher entirely (status 200 + the jsonrpc-2.0/dotted-result regex is already specific to apiinfo.version, nothing else answers that shape) or make it condition: or with both types. fix that and it's in.
|
you were right and it is worse than a mismatch, the module could never have $allowed_content = [ so those three types are a request precondition (412 otherwise) and the response the test was asserting the bug back at itself, it served the mock as |
There was a problem hiding this comment.
Pull request overview
Adds new reconnaissance/info modules to fingerprint Zabbix and Icinga monitoring frontends, plus a new recon module (and test) to detect unauthenticated Zabbix JSON-RPC version disclosure.
Changes:
- Added
zabbix-api-exposureHTTP module to detect unauthenticatedapiinfo.versionexposure and extract the leaked version. - Added
zabbix-panelandicinga-panelHTTP modules to fingerprint the respective login panels using framework-specific markup. - Added a Go unit test covering positive/negative cases for
zabbix-api-exposure.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/recon/zabbix-api-exposure.yaml | New recon module to detect Zabbix JSON-RPC version leak and extract version. |
| modules/info/zabbix-panel.yaml | New info module to identify Zabbix login panel via HTML markers and extract server name. |
| modules/info/icinga-panel.yaml | New info module to identify Icinga Web 2 login panel via HTML markers. |
| internal/modules/zabbix_api_exposure_test.go | New unit test validating the Zabbix API exposure module behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - type: regex | ||
| part: body | ||
| regex: | ||
| - '"jsonrpc"\s*:\s*"2\.0"\s*,\s*"result"\s*:\s*"[0-9]+\.[0-9]+(\.[0-9]+)?"' |
985030d to
fd8093c
Compare
|
one more on the api module: the body regex required "jsonrpc":"2.0" immediately split into two and'd patterns so the match is order-insensitive, with a test |
|
CI on this branch is red for a reason unrelated to the change: main does not internal/modules/executor.go:197:57: undefined: MaxBodySize #374 fixes it. this branch builds and tests clean with that one-line fix applied |
fd8093c to
5be1614
Compare
zabbix-panel and icinga-panel fingerprint the monitoring frontends by two framework-specific login-page classes under an and-condition, so a generic 200 cannot trip them. zabbix-api-exposure posts the unauthenticated apiinfo.version json-rpc call and requires both the json-rpc content-type and a dotted-version result, so a foreign json-rpc service or a version served under another content-type stays silent.
drop top-line comments that just restate the id/name fields already present in the same file
application/json-rpc is a request precondition, not a response type.
ui/api_jsonrpc.php accepts application/json-rpc, application/json or
application/jsonrequest and answers 412 otherwise, then always sets
`header('Content-Type: application/json')`. matchers are and'd, so
requiring json-rpc back meant the module never fired against a live
instance.
the test served the mock as application/json-rpc and asserted the real
application/json case produced no findings, so it locked the dead
behaviour in. it now runs the real shape and keeps json-rpc as a second
firing case for proxies that echo the request type.
status 200 plus the jsonrpc-2.0 dotted-result regex is already specific to
apiinfo.version; a json-rpc error body stays silent.
5be1614 to
bfcdd92
Compare
|
you're right — that was the request content-type leaking into the response matcher. dropped the response content-type matcher entirely: fixed the test to match real behavior: the mock now answers |
There was a problem hiding this comment.
Reviewed at bfcdd92. CI is green and the branch merges cleanly into current main (no zabbix/icinga module ID collisions on main).
The change @vmfunc asked for is in: the response content-type matcher is gone, Content-Type: application/json-rpc is only sent as a request header, and the API module now keys on status 200 plus two and'd regexes. The test now uses the real application/json response. I see no correctness or security problems in the API module.
Remaining suggestions (none blocking):
- Panel modules have no tests.
zabbix-panelandicinga-panelare the only new modules without fire/silent coverage. Other panels are covered ininternal/modules/login_panels_test.go. Please add a case per panel there: one that fires on a minimal real login-page snippet, one that stays silent when only one of the two markers is present (this is what proves the and-condition works), and an assertion thatzabbix_server_namegets extracted. - Subtests.
TestZabbixAPIExposureModuleruns five scenarios in one function. Splitting them intot.Run(...)subtests, as the sibling exposure tests do, would make failures easier to identify. - Duplicate findings on root installs (minor). On
zabbix-panel,{{BaseURL}}and{{BaseURL}}/index.phpusually serve the same login page on a root-mounted Zabbix, so one host can produce two findings. Other panel modules do this too, so it's fine to keep. Dropping the bare{{BaseURL}}path would remove the duplicate if you'd rather avoid it.
Merge status: still blocked on the existing CHANGES_REQUESTED review. It needs a maintainer to re-review and approve the latest commit.
| condition: and | ||
| words: | ||
| - 'id="icinga-logo"' | ||
| - 'class="login-form"' |
There was a problem hiding this comment.
Please pin these two markers with a test fixture taken from real Icinga Web 2 login markup (2.11/2.12). id="icinga-logo" and class="login-form" are plausible, but no test covers them. If upstream renders the form with a different class, the and-condition will never match, which is the same problem the API module had with its content-type matcher.
zabbix-panel and icinga-panel fingerprint the monitoring frontends by two framework-specific login-page classes under an and-condition, so a generic 200 cannot trip them. strings were verified against current upstream login markup.
zabbix-api-exposure posts the unauthenticated
apiinfo.versionjson-rpc call and matches on status 200 plus a jsonrpc-2.0 dotted-result body, which nothing but apiinfo.version answers with. it does not match on the response content-type:application/json-rpcis a request precondition,ui/api_jsonrpc.phpaccepts application/json-rpc, application/json or application/jsonrequest and answers 412 otherwise, then always setsheader('Content-Type: application/json'). since matchers are and'd, requiring json-rpc back meant the module never fired against a live instance.the
lowseverity matches the compatible-shape (not product-string) nature of that evidence. the test drives the real application/json response, keeps application/json-rpc as a second firing case for proxies that echo the request type, and pins a json-rpc error body as silent.