3 ms·
> So with this I can XSS myself while in development mode on my development system? That's handy. Or someone can send you a URL that points to your dev server
by nbpoole 15y ago
> So with this I can XSS myself while in development mode on my development system? That's handy.
Or someone can send you a URL that points to your dev server and contains a payload. Or someone can send a URL to the developer across the street who uses shared hosting where display_errors is enabled by default.
I'm not arguing that this is a feasible attack to pull off against most applications: it most certainly is not. I'm arguing that it shouldn't be possible to pull it off at all, even in the small percentage of applications that might be affected. There is no good reason PHP should be displaying this information unsanitized.
---
You're 100% correct about the example you're pointing out. If you're allowing arbitrary functions called from the user, you're in much bigger trouble. ;-)
I originally noticed and reported the issue with the first example, which triggers a simple, common undefined index notice:
<?php
error_reporting(E_ALL);
$array = array();
echo $array[$_GET['index']];
I only included the others for the sake of completeness. I've updated the code sample to note that.
- pilif 15y ago> Or someone can send you a URL that points to your dev server and contains a payload. That is theoretically possible, though what they would be able to do is to deal damage to my development install (if I don't to CSRF protection on POST operations) or they could potentially hijack my current session on my development system, which, too I don't deem too critical. > who uses shared hosting where display_errors is enabled by default init_set('display_errors', 0); Even on a shared host you can turn display_errors off. > There is no good reason PHP should be displaying this information unsanitized. I agree, especially because they already do some escaping of their own errors (and consequently don't escape while running in the CLI SAPI)
- smsm42 15y agoIs there any other language that encodes its error messages so they are 100% XSS safe?