DataLife Engine 9.7 (preview.php) PHP Code Injection Vulnerability
User input from the catlist request parameter was placed into a preg_replace call using the e modifier without sanitisation. An attacker could inject PHP code that the e modifier would execute on the server.
karmainsecurity.com
Published on karmainsecurity.com
User supplied input passed through the $REQUEST[‘catlist’] parameter is not properly sanitized before being used in a pregreplace() call with the e modifier at lines 249 and 253. This can be exploited to inject and execute arbitrary PHP code.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the code interpolates the unsanitised catlist parameter into the replacement string of a preg_replace call that uses the e modifier, which evaluates that string as PHP.
What the attacker needed
Access to preview.php; ability to send request parameters
The fix
The code should stop using the e modifier and sanitise or validate the catlist parameter before it reaches any pattern replacement.
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 write-up has not been written yet. The Original tab links to the source.
The site takes a value from the visitor and drops it into a pattern-matching function. That function has an old option that treats the replacement text as PHP code and runs it, so crafted input becomes code running on the server. This is called code injection and can lead to full control of the site.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.