Skip to content
Memory corruption Write-up Advanced

PHP2Shell — Remote Code Execution Through PHP Runtime Memory Corruption

The report describes two PHP runtime vulnerabilities related to out-of-memory corruption and stale internal global state that may lead to memory corruption and remote code execution. A lab record shows command execution as the web server user against a test endpoint, but the link to the Shopping Portal application is not established.

Hemant Raj Bhati Follow

Published on medium.com

PHP2Shell consists of two PHP vulnerabilities associated with out-of-memory corruption and stale internal global state. Under vulnerable conditions, these issues may result in memory corruption and remote code execution.

Hemant Raj Bhati, on medium.com

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 memory corruption caused by out-of-memory conditions and stale internal global state in the PHP runtime.

Impact

Successful exploitation may allow an attacker to execute commands with the privileges of the PHP process, potentially exposing sensitive data or affecting order processing and service availability, but the report notes that actual data exposure must be independently verified and the link to the Shopping Portal is unproven.

What the attacker needed

PHP 8.4.26 or vulnerable version; Access to the vulnerable endpoint; Lab environment for testing

The fix

Upgrade PHP to an applicable security-fixed release, such as PHP 8.4.27 or later, or apply the vendor-provided security-fixed package, and verify the active runtime.

How it was found

  1. Confirm the PHP runtime and package used by the Shopping Portal.
  2. Establish whether the lab endpoint belongs to the same application deployment.
  3. Check the installed PHP package against the official advisory and vendor security notices.
  4. Perform authorized validation in an isolated test environment.
  5. Record reproducible results and distinguish lab evidence from project-specific evidence.

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.

This report is about bugs in the PHP programming language runtime itself, not in the shopping website's own code. If exploited, an attacker might be able to run commands on the server with the same permissions as the web server. However, the report only shows this working in a separate test setup, and it is not proven that the shopping site is affected.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Hemant Raj Bhati

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.