Skip to content
goTool Español

Solutions · Containers

mi-app: new code inside the container

With example names (mi-app, /ruta/al/proyecto). In GoTool, in 🛡 Security, this page shows your project's: your container, your compose file, your WordPress folder.

What's happening

Inside container mi-app, /var/www/html/x.php has appeared, which isn't like that in its image (mi-imagen:1.0).

Why it matters

Code shouldn't appear inside a container: what belongs there is what the Dockerfile puts in. It's what someone who gets in through the application leaves behind (a backdoor, a miner), and it stays until the container is recreated.

What to do

  1. Copy it out without running it, to look at it and keep it as evidence:
    docker cp mi-app:/var/www/html/x.php ./prueba-x.php
  2. Recreate it with the change (whatever isn't in a volume is lost: that's the point):
    docker compose -f /ruta/al/proyecto/compose.yaml up -d --force-recreate app
  3. Find out how they got in: the application's logs from those hours and its libraries (the project's critical issues in 🛡).
  4. So it doesn't happen again, make the container read-only, with a temporary folder for whatever it has to write:
    read_only: true
    tmpfs:
      - /tmp

How to know it's fixed

  • It must not show up in what changed from its image:
    docker diff mi-app
  • gotool checks your Docker again on its next pass: once it's gone, it stops showing up.

If you can't do it that way

  • If it's expected (something the application generates at startup), mark it as closed with its reason in the project's 🛡; better still, have it generated when the image is built.

More

CWE-494 · MITRE ATT&CK T1505.003

In GoTool, the file with the issue (the Dockerfile, the compose file) is also shown with the solution next to it, and the question for Claude comes ready, with your project's details and without your keys, to paste into your claude.ai.

Ask us for a demo