PHP link() silently truncates after a null byte on Windows
On Windows, PHP's link() function accepted filenames containing a null byte and treated the name as ending at that byte. An attacker could use crafted input to make an application read or write files outside an intended restricted set.
- Triaged in 5 hours
- Fixed in 7 months
- Paid in 7 months
- Disclosed after 8 months
The bug submitted at: https://bugs.php.net/bug.php?id=78862 The security advisory at: https://nvd.nist.gov/vuln/detail/CVE-2019-11044
The issue allow remote attackers to read or write arbitrary files via crafted input to an application that calls the vulnerable function. As demonstrated by a file\0.ext attack that bypasses an intended configuration in which users may read or write only files.
Impact
In PHP versions 7.2.x below 7.2.26, 7.3.x below 7.3.13 and 7.4.0 on Windows, PHP link() function accepts filenames with embedded \0 byte and treats them as terminating at that byte. This could lead to security vulnerabilities, e.g. in applications checking paths that the code is allowed to access.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
This could lead to security vulnerabilities, for example in applications that check which paths the code is allowed to access, potentially allowing reads or writes of arbitrary files.
What the attacker needed
Windows PHP 7.2.x < 7.2.26, 7.3.x < 7.3.13, or 7.4.0; application calls link() with attacker-controlled input
The fix
The issue affects PHP 7.2.x below 7.2.26, 7.3.x below 7.3.13 and 7.4.0 on Windows; the text does not describe the fix.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A null byte is a special character that some older programs treat as the end of a text string. If a security check looks at the full filename but the file operation stops at the null byte, the check and the action disagree. An attacker can exploit that gap to reach files the application meant to block.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.