Repository navigation
Conversation
…ASP#1945) The \;version:\1 and \;confidence suffixes are Wappalyzer syntax, not part of the match, so these fingerprints could not match real responses. Strip the suffix from 20 entries (Nginx and the entries with $ before the suffix) and add tests for each.
|
No actionable comments were generated in the recent review. Summary by CodeRabbit
WalkthroughSelected web technology header patterns no longer include Wappalyzer version-extraction suffixes. Unit tests check representative header matches, empty and neutral responses, generic Nginx detection, and selected incorrect header values. ChangesHeader fingerprint detection
Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested labels: Merge Risk:
|
Closes #1945
This is the first batch of #1945. It replaces #1957, which the contribution bot closed because the closing reference was missing when it was opened. About 440 lines remain, so I will open a follow-up issue and ask for assignment before sending the next batch.
Proposed change
Many regexes in
nettacker/modules/scan/web_technologies.yamlstill carry Wappalyzer's version-extraction suffix (\;version:\1,\;confidence:NN). In a Python regex\;is a literal;, so the pattern also requires the text;version:in the response, which real servers never send. The fingerprint therefore cannot match. This PR removes the suffix from 20 lines: the NginxServerregex (it only matches if the response contains;version:) and 19 single-line regexes where an unescaped$sits right before the suffix, which makes a match impossible. Only the suffix text is removed from those lines; everything else is unchanged (20 insertions, 20 deletions, 238 characters removed). Versions are not reported; this is detection only.Not in this PR:
$precedes the suffix are left out on purpose. Four single-line entries: Botble (itsconfidence:0made it a weak fingerprint, so stripping it would make it over-broad), CodeIgniter (stripping changes nothing), FancyBox and Inveon (content patterns where$means the end of the body). Three multi-line content patterns (Elementor, Gravity Forms, SonarQube) that my issue's count missed: in each only the last|branch is dead and the other branches still match.$(for example Apache and Python's SimpleHTTP; I confirmed both are missed on real containers).Verification
Real containers on an isolated Docker network with no published ports,
web_technologies_scan, technologies reported on upstream/master (2f23fab) and on this branch:Server: nginx/1.30.4server_tokens offServer: nginxX-Powered-By: EasyEngine v4X-Powered-PublicCMS: V6Server: Warp/3.4.21on/version;GET /returns 405kbn-versionon/,/loginor/api/statusServer: Apache/2.4.71 (Unix)Server: CaddyServer: SimpleHTTP/0.6 Python/3.11.16Apart from the intended new detections (Nginx, EasyEngine, Public CMS) the two states are identical. Apache and Python are missed in both states because they carry the suffix without
$(not in this batch).I also ran the Nginx case myself on the official nginx container (
Server: nginx/1.30.4, port 8081, real CLI:python nettacker.py -i 127.0.0.1 -m web_technologies_scan -g 8081 -t 1 -M 1 --skip-service-discovery).Before, upstream master (61bab4e): no technology reported, only the generic status row.
After, this branch: "Nginx Found".
Real software: Nginx, EasyEngine (v4.15.0) and Public CMS (V6) are detected on this branch and not on master. The Nginx run I did myself; the others were run by Claude Code against pinned images on an isolated network, and I reviewed the captured headers. Warp's real header matches the edited regex, but the pandoc server I could run answers
GET /with 405, so the module cannot see it. Kibana 8.19.23 does not sendkbn-versionat all, so that fingerprint is stale for current Kibana (the edit is still correct; it just cannot fire there). I did not run Shopware (1.6 GB); from its source the two headers are not sent onGET /. The remaining entries are covered only by unit tests with sample responses built from each product's source or documentation (links in the test file): several are SaaS or proprietary (Oracle Commerce Cloud, Shopfa, SharePoint), and the others (Kooboo, Umbraco, Neos, Sulu, CppCMS, Aegea, PHPFusion, Arastta) need a source build or a database, or have no maintained image. Where I found no vendor documentation (Aegea, Arastta, Kooboo, Oracle Commerce Cloud, PHPFusion, Shopfa) the sample comes from the webappanalyzer fingerprint, so it is not verified against the real product.Tests:
tests/unit/test_web_technologies_scan.py(233 tests) runs each edited entry throughTemplateLoaderandresponse_conditions_matched, the same path the module uses. It checks a positive sample, a negative sample, eight neutral server responses, that the suffix is gone, and that no edited regex matches the empty string.tests/unit/test_yaml_schema_and_regex.pystill passes (134 passed, 6 skipped).Limits and questions
add_headerthat may drop the header), Public CMS only on/after the install, Kibana only in setup mode without Elasticsearch, and Warp only where/is not 200. Some unit test samples are older than what the real products send (Kibana 4.5kbn-version, EasyEngine 2.2.3, Public CMS V5); the real responses also match the regexes, except Kibana 8, which sends nokbn-version. The Public CMS header format and the Shopware headers onGET /are unconfirmed.AI tools were used in preparing this PR. I reviewed the diff and the tests and can explain every change.
Type of change
Checklist
make pre-commitand confirm it didn't generate any warnings/changesmake testand I confirm all tests passed locallydocs/folder (no user-facing behavior or description text changed)