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

Cross site scripting persistant #4

Open
tahriabd opened this issue Jan 7, 2019 · 3 comments
Open

Cross site scripting persistant #4

tahriabd opened this issue Jan 7, 2019 · 3 comments

Comments

@tahriabd
Copy link

tahriabd commented Jan 7, 2019

Hi,

$subject and $comments in insert.php are vulnerables to xss attack: a remote attacker could inject à malicious javascript to corrupt user for example: <script>alert(1)</script>

to correct this vulnerability you need to escape html characteres by

htmlentities($comments, ENT_QUOTES)

and htmlentites($subject, ENT_QUOTES)

https://www.acunetix.com/websitesecurity/cross-site-scripting/

@alexander-zierhut
Copy link

alexander-zierhut commented Nov 8, 2020

Great observation @tahriabd
It would even be better to fix this using parameter binding. It is vital that code like yours is not published with those kinds of problems. Beginners will simply copy and paste it. https://www.php.net/manual/en/mysqli-stmt.bind-param.php

@tahriabd
Copy link
Author

tahriabd commented Nov 8, 2020

I agree, The best way is to use prepare statement like pdo or framework symfony but here, it s just a quick fix for who want to test code. The quick fix proposed in commit on issue #5 is safe too

@tahriabd tahriabd closed this as completed Nov 8, 2020
@tahriabd tahriabd reopened this Nov 8, 2020
@alexander-zierhut
Copy link

Very true. But I guess this fill never be fixed / merged / updated on the website

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

2 participants