fix: remove assert() RCE sink in legacy_auth.php#104
Open
hacktron-app-stg[bot] wants to merge 1 commit into
Open
fix: remove assert() RCE sink in legacy_auth.php#104hacktron-app-stg[bot] wants to merge 1 commit into
hacktron-app-stg[bot] wants to merge 1 commit into
Conversation
Passing $_GET['check'] into assert() evaluates the string as PHP code on affected versions/configs, allowing remote code execution. Handle the parameter as data instead of evaluating it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vulnerability
legacy_auth.php:27passed raw user input directly intoassert():On PHP versions/configurations where
assert()evaluates a string argument as PHP code (PHP < 7.2, or withassert.active/string evaluation enabled), an attacker could execute arbitrary PHP — e.g.?check=system('whoami')— leading to remote code execution.Fix
The
assert()call is removed. Thecheckparameter is now handled strictly as data: cast to a string and, when non-empty, echoed back HTML-escaped viahtmlspecialchars(). User input is never evaluated as code.Verification
legacy_auth.php:27matched the taint path ($_GET['check']→assert()).assert()call is fully removed; the remaining code only treats the input as an escaped string.php -l(PHP is not installed in the sandbox), but the edit is a self-contained, syntactically simple replacement. The change is scoped to VULN 4 only; the other pre-existing intentional demo vulnerabilities in this file were left untouched as they are outside this finding.Automated fix by Hacktron for finding: https://staging.hacktron.ai/testestesttest/findings/202f3e81-e1b2-481c-aaf5-c110007861af