Repository navigation
Fix Pi-hole token response validation - #22143
urvalkheni wants to merge 1 commit into
Conversation
Reject missing and unsuccessful HTTP responses before token extraction. Previously, a nil response could raise NoMethodError, while non-200 responses could incorrectly proceed to token parsing. Add regression coverage for nil and HTTP 500 responses. Signed-off-by: Urval Kheni <kheniurval777@gmail.com>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Description
Fix response validation in the shared Pi-hole HTTP helper,
Msf::Exploit::Remote::HTTP::Pihole#get_token.Previously, the response guard was:
This caused two issues:
nilresponse could raise an unexpectedNoMethodErrorwhen accessingres.code.Replace it with:
This safely handles missing responses and rejects unsuccessful HTTP responses before token extraction.
Added regression tests covering:
nil) HTTP responses.Verification
msfconsole.use auxiliary/admin/http/pihole_domains_api_execRHOSTSandRPORTagainst a target (or mock HTTP server).unexpected-reply: Unable to find tokeninstead of raisingNoMethodError.unexpected-reply: Unable to find tokeninstead of proceeding to token parsing.bundle exec rubocop lib/msf/core/exploit/remote/http/pihole.rb spec/lib/msf/core/exploit/http/pihole_spec.rband confirm 0 offenses.Results and evidence
Validation was performed against a localhost mock HTTP server. The mock discarded the submitted command and did not execute it.
1. Nil response — before patch
After patch
2. HTTP 500 response containing token string — before patch
After patch
3. Static analysis and test status
RSpec note: 0 examples ran locally because the local test environment requires a configured database.
AI Disclosure
Codex was used for codebase understanding.