46: $site_id = $_GET['site'];
55: die ('site ' . $site_id . ' does not exist');
Unsanitized GET paramenter site is being sent to die() without no santization
Fix: use htmlentities();
Thanks,
In Piwigo/admin/site_update.php
```
46: $site_id = $_GET['site'];
55: die ('site ' . $site_id . ' does not exist');
```
Unsanitized GET paramenter site is being sent to die() without no santization
Fix: use htmlentities();
Thanks,
<!-- github-sync-id:196307554 -->
@plegall that code is equivallent to:
`die ('site ' . $_GET['site']; . ' does not exist'); `
Which can be used to perform XSS by sending parameters like:
http://localhost/tez.php?site=%3Csvg/onload=alert%28document.cookie%29%3E%3C/svg%3E
^ that will alert your cookies in Firefox.
you can use htmlentities() on $site_id it will sanitize it. example:
46: $site_id = htmlentities($_GET['site'],ENT_QUOTES);
Thanks,
<!-- github-comment-id:267977288 -->
if (!is_numeric($_GET['site']))
{
die ('site param missing or invalid');
}
$site_id = $_GET['site'];
is that not safe?
Thanks for your example.
Actually, in admin/site_update.php I find:
```
if (!is_numeric($_GET['site']))
{
die ('site param missing or invalid');
}
$site_id = $_GET['site'];
```
is that not safe?
<!-- github-comment-id:268240892 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
In Piwigo/admin/site_update.php
Unsanitized GET paramenter site is being sent to die() without no santization
Fix: use htmlentities();
Thanks,
Can you give us an example when it can be problematic?
@plegall that code is equivallent to:
die ('site ' . $_GET['site']; . ' does not exist');Which can be used to perform XSS by sending parameters like:
http://localhost/tez.php?site=%3Csvg/onload=alert%28document.cookie%29%3E%3C/svg%3E
^ that will alert your cookies in Firefox.
you can use htmlentities() on $site_id it will sanitize it. example:
46: $site_id = htmlentities($_GET['site'],ENT_QUOTES);
Thanks,
Thanks for your example.
Actually, in admin/site_update.php I find:
is that not safe?