All challenges

Second-order SQL injection

webmedium250pts

Second-order SQL injection

Registration stores your username with a properly parameterized INSERT, so nothing happens there. A later profile feature reads the stored username back and string-concatenates it into an UPDATE, and the payload fires in that second context. Hijack the admin row, take over the account, and read what only the admin can see.

How to reach it

Run the challenge locally with its docker-compose. The flagger sidecar writes your per-run flag to /flag/flag.txt, which the entrypoint seeds into the admin database row. The service speaks HTTP on port 8080; registration is the entry point.

Run this challenge

Spin it up locally with Docker. The flagger sidecar fetches a per-run flag into a shared volume, then the challenge container boots and reads it.

compose.yml
services:
  flagger:
    image: matejbasic/rootcause-flagger:1.0
    environment:
      ROOTCAUSE_API_URL: https://root-cause-api.matejbasic.com
      ROOTCAUSE_API_KEY: ${ROOTCAUSE_API_KEY}
      ROOTCAUSE_CHALLENGE: second-order-sqli
      FLAG_PATH: /flag/flag.txt
    volumes:
      - flag:/flag
  challenge:
    image: matejbasic/second-order-sqli:1.0
    depends_on:
      flagger:
        condition: service_completed_successfully
    environment:
      FLAG_PATH: /flag/flag.txt
    volumes:
      - flag:/flag
    ports:
      - "8080:8080"
volumes:
  flag:
one-line CLI
rootcause start second-order-sqli

The rootcause CLI does all of this in one command. Running a challenge needs your API key, which you generate in your profile.