You are signed in. Close

You are signed out. Close

Thank you. Your subscription has started. Close

Thank you. You will get an email when a new comic comes out. Close

Almost done. Check your inbox and press the button in our email to confirm. Close

We could not check that you are a person. Please try again. Close

We could not confirm your payment. If you paid, use the link "Sign in" at the bottom of the page. Close

Something went wrong on our side. Please try again in a moment. Close

Previous episode php2shell: the PHP bug that made governments switch off their own websites

php2shell: the PHP vulnerability that shook the web in 2026

PHP file uploads: how one strange form trips PHP before a website even starts

A website can check every uploaded file with great care. With php2shell, that care came too late. The attack was over before the website's own code had read a single line.

  1. 1 A visit can also send things. When you add a photo of soup to a new recipe, your browser sends it to the server in a form. Anything a browser sends to a server is called a request.

    A visit can also send things. When you add a photo of soup to a new recipe, your browser sends it to the server in a form. Anything a browser sends to a server is called a request.

  2. 2 Before WordPress sees anything, PHP opens the request and unpacks it: the text goes here, the files go there. PHP does this for every page, and WordPress cannot tell it to stop.

    Before WordPress sees anything, PHP opens the request and unpacks it: the text goes here, the files go there. PHP does this for every page, and WordPress cannot tell it to stop.

  3. 3 Rono sends a form too. It looks like an upload, but it is built as boxes inside boxes inside boxes. To unpack it, PHP needs far more working space, called memory, than any normal form.

    Rono sends a form too. It looks like an upload, but it is built as boxes inside boxes inside boxes. To unpack it, PHP needs far more working space, called memory, than any normal form.

  4. 4 Halfway through, PHP runs out of memory. It stops on the spot, in the middle of its work.

    Halfway through, PHP runs out of memory. It stops on the spot, in the middle of its work.

  5. 5 Most of the time, that is harmless. The visitor gets an error, and the next visitor is fine. But this time, PHP left notes in memory that were only half written. Later, PHP tidies its memory. It reads those notes and trusts them, as if they were finished.

    Most of the time, that is harmless. The visitor gets an error, and the next visitor is fine. But this time, PHP left notes in memory that were only half written. Later, PHP tidies its memory. It reads those notes and trusts them, as if they were finished.

  6. 6 Your blog's code never ran. No plugin, no password and no line you wrote was used. And the half-written notes are still in memory.

    Your blog's code never ran. No plugin, no password and no line you wrote was used. And the half-written notes are still in memory.

  7. Quick check

    A careful plugin.

    A careful plugin.

    Show the answer

    No. PHP unpacks the form before your blog's code runs, and the plugin is part of your blog's code. The plugin never sees the form.

Next episode Remote code execution: how a crash in PHP gave strangers a shell on the server

Share this comic

More comics