Skip to content

fix: remove assert() RCE sink in legacy_auth.php#104

Open
hacktron-app-stg[bot] wants to merge 1 commit into
add-legacy-auth-phpfrom
hacktron/fix-202f3e81
Open

fix: remove assert() RCE sink in legacy_auth.php#104
hacktron-app-stg[bot] wants to merge 1 commit into
add-legacy-auth-phpfrom
hacktron/fix-202f3e81

Conversation

@hacktron-app-stg

Copy link
Copy Markdown

Vulnerability

legacy_auth.php:27 passed raw user input directly into assert():

assert($_GET['check']);               // ?check=system('id')

On PHP versions/configurations where assert() evaluates a string argument as PHP code (PHP < 7.2, or with assert.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. The check parameter is now handled strictly as data: cast to a string and, when non-empty, echoed back HTML-escaped via htmlspecialchars(). User input is never evaluated as code.

Verification

  • Confirmed the sink at legacy_auth.php:27 matched the taint path ($_GET['check']assert()).
  • The dangerous assert() call is fully removed; the remaining code only treats the input as an escaped string.
  • Could not run 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

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.
@hacktron-app-stg
hacktron-app-stg Bot requested a review from maekuss July 23, 2026 04:15
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.

0 participants