The .htaccess that made JPEGs run as PHP
An .htaccess file in the uploads folder tells Apache to run .jpg files as PHP. Find it, the uploaded “image” that abused it, and the commands passed in its query string.
- Terminal mission
- Intermediate
- 3 questions
- 0 of 3 solved
Your goal
Your goalFind the setting that made images run as code and what the attacker did with it.
Avatar uploads are checked by extension: only .jpg and .png are allowed. That check is fine as long as the server never executes those files.
Apache reads .htaccess files in every directory when AllowOverride permits it. AddType or AddHandler there can change how a file extension is handled.
What’s on screen
- Briefing
- the story: what happened and what evidence you were handed.
- Terminal
- the dark box. It is a pretend Linux shell that runs in your browser. Type a command and press Enter. Nothing you type touches a real system.
- Walkthrough
- the numbered path. Each step says what to type and what you should see. Hints open one at a time.
- Answer boxes
- under each question step. Type what you found and press Check.
Words to know
- PHP
- a language many web servers run
community-01 · Web config review
Type help for the command list and objectives for your tasks. Everything runs in this browser.
Up and down arrows walk your history. Ctrl+L clears the screen. Try help, ls, and objectives.
Read first
More in Web config review
The whole walkthrough
Every step in order: 272 words, about 2 min. It gives away every answer, so try the steps first.