PHP : Phar Deserialization
Classification
Overview
Phar deserialization is a vulnerability which allows an attacker to execute any code in a vulnerable application. The vulnerability is in the serialized metadata of the phar file. It means that injected code is executed in the application’s scope. It happens with any file operation with the infected object. The necessary condition for the attack is the presence of a vulnerability that allows the user to control the paths for interaction with the file system, for example, when checking for the existence of the file or library loading.
If an operation with a file containing unserialized metadata is performed using phar:// prefix and the application has AnyClass class with __destruct() and __wakeup() methods, these methods will be called automatically.
References
- Top 10 2013-A1-Injection
- CWE-502: Deserialization of Untrusted Data
- [It’s a PHP unserialization vulnerability Jim, but not as we know it](https://github.com/s-n-t/presentations/blob/master/us-18-Thomas-It’s-A-PHP-Unserialization-Vulnerability-Jim-But-Not-As-We-Know-It.pdf)
- CWE CATEGORY: OWASP Top Ten 2017 Category A1 - Injection
DerScanner Severity Score
Check your PHP code for this vulnerability, free
Request a free pilot of DerScanner. We give you access and help with the first scan. It works in the cloud and on-premise.
Try it on your code, free
By submitting this form, I acknowledge that DerScanner may process my personal data I provided above for purposes explained above. More details about the processing.
