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

getleaderboard.aspx returns an unlimited number of entries #82

Open
cetteup opened this issue Dec 17, 2024 · 0 comments
Open

getleaderboard.aspx returns an unlimited number of entries #82

cetteup opened this issue Dec 17, 2024 · 0 comments

Comments

@cetteup
Copy link

cetteup commented Dec 17, 2024

The number of returned leaderboard entries is not limited at all. Allowing anyone to dump all players with e.g. score > 0 in a single request. Depending on the number of players in the database, this becomes a DoS vector.

$after = (isset($_GET['after'])) ? (int)$_GET['after'] : 19;
$before = (isset($_GET['before'])) ? (int)$_GET['before'] : 0;
$pos = (isset($_GET['pos'])) ? (int)$_GET['pos'] : 1;
$min = ($pos - 1) - $before;
$max = $after + 1;
// Negative correction
if ($min < 0) $min = 0;
if ($max < 0) $max = 0;

The game loads 20 entries per page by default, which seems like a sensible limit. So $max should simply be set the minimum of $min+min($after+1, 20).

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