Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concatenating assignment operator loses taint #37

Open
Grunny opened this issue Oct 6, 2016 · 0 comments
Open

Concatenating assignment operator loses taint #37

Grunny opened this issue Oct 6, 2016 · 0 comments

Comments

@Grunny
Copy link

Grunny commented Oct 6, 2016

Running PHP 7.0.10 using the concatenating assignment operator appears to lose taint.

If I run the following script which concatenates strings normally:

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

$a = "tainted string" . ".";
taint($a);
$b = 'some string ' . $a;

echo $b;

I get the following output as expected:

Warning: main() [echo]: Attempt to echo a string that might be tainted in /path/to/taint-test.php on line 9

Call Stack:
    0.0001     356120   1. {main}() /path/to/taint-test.php:0

some string tainted string.

However, if I instead use the concatenating assignment operator in the following script:

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

$a = "tainted string" . ".";
taint($a);
$b = 'some string ';
$b .= $a;

echo $b;

The output is simply some string tainted string. and no warning is raised.

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

No branches or pull requests

1 participant