Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(secu): Type juggling can lead to authentication bypass in (very) … #7084

Merged
merged 1 commit into from
Mar 14, 2019

Conversation

gquere
Copy link
Contributor

@gquere gquere commented Dec 21, 2018

…rare cases

The '==' operator is a loose comparison operator, whereas the '===' does a strict comparison.
The truth table of the '==' operator is quite ugly (https://www.owasp.org/images/6/6b/PHPMagicTricks-TypeJuggling.pdf) and can lead to undesirable integer promotion results.

For instance, when loose comparing something that looks like integers, PHP will promote both strings to integers.

Example: if the user's token starts with "0e" and is followed by numbers, it is bypassable by the string "00" because in PHP, ("0e123456" == "00") is TRUE.
http://192.168.56.3/centreon/index.php?p=1&autologin=1&useralias=admin&token=00

Altough, the probabilty this can happen to e.g. the token is very low:
1/62 * (2/62) * (10/62)^6

PLEASE NOTE THAT THIS PULL REQUEST IS TO INFORM YOU OF A SECURITY PROBLEM AND HAS NOT BEEN PROPERLY TESTED.

…rare cases

The '==' operator is a loose comparison operator, whereas the '===' does a strict comparison.
The truth table of the '==' operator is quite ugly (https://www.owasp.org/images/6/6b/PHPMagicTricks-TypeJuggling.pdf) and can lead to undesirable integer promotion results.

For instance, when loose comparing something that looks like integers, PHP will promote both strings to integers.

Example: if the user's token starts with "0e" and is followed by numbers, it is bypassable by the string "00" because in PHP, ("0e123456" == "00") is TRUE.
    http://192.168.56.3/centreon/index.php?p=1&autologin=1&useralias=admin&token=00

Altough, the probabilty this can happen to e.g. the token is very low:
    1/62 * (2/62) * (10/62)^6
@miteto miteto self-requested a review February 26, 2019 09:59
@adr-mo
Copy link
Contributor

adr-mo commented Mar 13, 2019

New branch created for the validation MON-3306-gquere-authentication_bypass

@miteto miteto merged commit 96e48f8 into centreon:master Mar 14, 2019
miteto pushed a commit that referenced this pull request Mar 14, 2019
…rare cases (#7084)

The '==' operator is a loose comparison operator, whereas the '===' does a strict comparison.
The truth table of the '==' operator is quite ugly (https://www.owasp.org/images/6/6b/PHPMagicTricks-TypeJuggling.pdf) and can lead to undesirable integer promotion results.

For instance, when loose comparing something that looks like integers, PHP will promote both strings to integers.

Example: if the user's token starts with "0e" and is followed by numbers, it is bypassable by the string "00" because in PHP, ("0e123456" == "00") is TRUE.
    http://192.168.56.3/centreon/index.php?p=1&autologin=1&useralias=admin&token=00

Altough, the probabilty this can happen to e.g. the token is very low:
    1/62 * (2/62) * (10/62)^6
miteto pushed a commit that referenced this pull request Mar 14, 2019
…rare cases (#7084)

The '==' operator is a loose comparison operator, whereas the '===' does a strict comparison.
The truth table of the '==' operator is quite ugly (https://www.owasp.org/images/6/6b/PHPMagicTricks-TypeJuggling.pdf) and can lead to undesirable integer promotion results.

For instance, when loose comparing something that looks like integers, PHP will promote both strings to integers.

Example: if the user's token starts with "0e" and is followed by numbers, it is bypassable by the string "00" because in PHP, ("0e123456" == "00") is TRUE.
    http://192.168.56.3/centreon/index.php?p=1&autologin=1&useralias=admin&token=00

Altough, the probabilty this can happen to e.g. the token is very low:
    1/62 * (2/62) * (10/62)^6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants