r/PHPhelp • u/NunyasBeesWax • Dec 13 '24
XSS scripting
Newb question. Trying the Hackazon app for XSS mitigation. Hitting my head against the wall for hours. Error on signin.php line:
Echo 'var amfphpEntryPointUrl = "' . $config->resolveAmfphpEntryPointUrl() . "";\n";
showing XSS with "Userinput reaches sensitive sink when function () is called."
Think I know conceptually to sanitize the data but having trouble finding the right answer. Htmlspecialchars?
TY in advance.
1
Upvotes
1
u/HolyGonzo Dec 13 '24
Are you certain that this is a correct response from RIPS? Sometimes RIPS gets false positives.
I don't have the Hackazon site installed but that RIPS finding is when it thinks that some user input made its way to output without being sanitized on display.
0
u/colshrapnel Dec 13 '24
No
-5
u/Matrix009917 Dec 13 '24
I believe we need to clear things up a bit.
Sanitization and rendering in HTML are two different aspects.
Sanitizing an input field provided by a user and displaying it in HTML are two separate concepts. Sanitization should be applied to the input context: for example, if it’s a string, use
trim()andstrip_tags(), if it’s an email, usefilter_var(). It depends on what you need to do.htmlspecialchars()allows you to "filter" potential code that could be used in an XSS attack, but sanitization must be done beforehand.