Skip to content

Fix tempnam() not being disabled in the fuzzer SAPI - #24719

Merged
ndossche merged 1 commit into
php:masterfrom
yumasansansan:fuzzer-disable-tempnam
Oct 26, 2026
Merged

ndossche merged 1 commit into
php:masterfrom
yumasansansan:fuzzer-disable-tempnam

Conversation

@yumasansansan

Copy link
Copy Markdown
Contributor

HARDCODED_INI in sapi/fuzzer/fuzzer-sapi.c disables functions with file system side effects, but lists tempname instead of tempnam. zend_disable_functions() silently ignores unknown names, so tempnam() is still callable. Running php-fuzz-execute on <?php tempnam("/tmp", "fuzzaudit_"); creates a file in /tmp; with this patch it does not.

Other write paths remain and are not addressed here, as they cannot be blocked through disable_functions without losing coverage: error_log($msg, 3, $file) and new SplFileObject($file, "w") both write files below the open_basedir (/tmp).

The disable_functions list contains "tempname", which does not exist,
so tempnam() stays available and fuzz inputs can create files in /tmp.

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol wtf

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks

@ndossche
ndossche merged commit 6e215f8 into php:master Oct 26, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants