fix: remove extract($_GET) variable overwrite in legacy_auth.php - #106
Open
hacktron-app-stg[bot] wants to merge 1 commit into
Open
fix: remove extract($_GET) variable overwrite in legacy_auth.php#106hacktron-app-stg[bot] wants to merge 1 commit into
hacktron-app-stg[bot] wants to merge 1 commit into
Conversation
Replace extract($_GET) with session-derived authentication state so an attacker can no longer set $authenticated via ?authenticated=1.
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.phpcalledextract($_GET)at line 16, importing every request parameter into the local variable scope. Because$authenticatedis a local variable, an attacker could overwrite it by supplying?authenticated=1, bypassing authentication entirely and causing the script to outputwelcome admin.extract()(high)legacy_auth.php:16Fix
Removed the
extract($_GET)call. The$authenticatedflag is now derived exclusively from the server-side session ($_SESSION['auth']), which is set only when a valid token is presented. Request parameters can no longer influence the authentication decision. A comment documents whyextract($_GET)must not be reintroduced.Verification
Reviewed the data flow: the only prior writer of
$authenticatedwas theextract($_GET)line; after removal, its value comes only from the session. PHP is not available in the sandbox, sophp -lcould not be run, but the edit is a minimal, self-contained change to a single statement. No regression test was added since the repository has no test infrastructure.Automated fix by Hacktron for finding: https://staging.hacktron.ai/testestesttest/findings/fb26269d-a9f2-4555-96ca-fff93f94a728