Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 69 guests online
 
Advertisement

You are here:
EH-Net
May 22, 2013, 12:35:52 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Go back to The Ethical Hacker Network Online Magazine Home Page
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Limited shell  (Read 3075 times)
0 Members and 1 Guest are viewing this topic.
H1t M0nk3y
Hero Member
*****
Offline Offline

Posts: 864



View Profile
« on: January 16, 2013, 08:45:05 AM »

Ok, here's another problem I have had for way too long now and I want to fix.

Here's the scenario: I have got a limited shell on a server in a lab through a web application vulnerability.

By "limited shell", I mean:
- The shell doesn't give me any output on the screen and I cannot output results of commands in a file
- I can change directory and list files (using a second ASP shell), but that's about it.
- I am able to ftp files/modify files into the web root directory (for example, I have uploaded nc.exe in C:\inetpub\wwwroot)

So for example:
C:\Windows\system32>cd ../..     (works)
C:\>cd inetpub\wwwroot    (works)
C:\inetpub\wwwroot> dir    (doesn't display anything)
C:\inetpub\wwwroot> dir > files.txt    (doesn't create a file)
C:\inetpub\wwwroot> nc.exe -lvp 4444    (doesn't work)
C:\inetpub\wwwroot> nc.exe -v 192.168.1.20 4444    (doesn't work either)

I have tried 5 or 6 different ASP shells, but couldn't get much more out of it.

So what approach should I take at this point? Write my own ASP shell code? Focus on trying to get a full shell (for example, using netcat somehow)? Maybe priv escalation (I don't think so at this point, but I could be wrong)

I really just need a direction so I can continue working on a solution...

Thanks


Logged

OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
ziggy_567
Sr. Member
****
Online Online

Posts: 361


View Profile
« Reply #1 on: January 16, 2013, 08:56:01 AM »

The link below is Linux specific, but there's quite a bit that could be adapted to Windows.

http://pen-testing.sans.org/blog/pen-testing/2012/06/06/escaping-restricted-linux-shells

Also, maybe something in there will click for you and give you some further avenues to explore.

Good luck!
Logged

--
Ziggy


eCPPT - GSEC - GCIH - GCUX - RHCE - SCSecA - Security+ - Network+
Dark_Knight
Sr. Member
****
Offline Offline

Posts: 292


View Profile WWW
« Reply #2 on: January 16, 2013, 09:26:00 AM »

Ok, here's another problem I have had for way too long now and I want to fix.

Here's the scenario: I have got a limited shell on a server in a lab through a web application vulnerability.

By "limited shell", I mean:
- The shell doesn't give me any output on the screen and I cannot output results of commands in a file
- I can change directory and list files (using a second ASP shell), but that's about it.
- I am able to ftp files/modify files into the web root directory (for example, I have uploaded nc.exe in C:\inetpub\wwwroot)

So for example:
C:\Windows\system32>cd ../..     (works)
C:\>cd inetpub\wwwroot    (works)
C:\inetpub\wwwroot> dir    (doesn't display anything)
C:\inetpub\wwwroot> dir > files.txt    (doesn't create a file)
C:\inetpub\wwwroot> nc.exe -lvp 4444    (doesn't work)
C:\inetpub\wwwroot> nc.exe -v 192.168.1.20 4444    (doesn't work either)

I have tried 5 or 6 different ASP shells, but couldn't get much more out of it.

So what approach should I take at this point? Write my own ASP shell code? Focus on trying to get a full shell (for example, using netcat somehow)? Maybe priv escalation (I don't think so at this point, but I could be wrong)

I really just need a direction so I can continue working on a solution...

Thanks



Are you able to run "net" commands for "net user" etc?
Logged

CEH, OSCP, GPEN, GWAPT, GCIA
http://sector876.blogspot.com
H1t M0nk3y
Hero Member
*****
Offline Offline

Posts: 864



View Profile
« Reply #3 on: January 16, 2013, 09:31:53 AM »

Thanks ziggy_567, I will be reading this tonight!!


Quote
Are you able to run "net" commands for "net user" etc?
No, it doesn't work either...

The IIS server is run with a pretty limited user...
Logged

OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
ajohnson
Recruiters
Hero Member
*
Offline Offline

Posts: 1057


aka dynamik


View Profile WWW
« Reply #4 on: January 16, 2013, 10:20:07 AM »

What shells are you trying to use? What OS and version of IIS are you using?

I've encountered instances where i can blindly execute commands, but I can't think of a time where I was using a web shell and wasn't able to receive output for non-privileged commands.

Here's another collection of shells you might want to try: http://laudanum.inguardians.com/ I'm pretty sure there is at least one ASP-based shell in there.
Logged

WIP: GCFA | www.infosiege.net | @infosiege

The day you stop learning is the day you start becoming obsolete.
H1t M0nk3y
Hero Member
*****
Offline Offline

Posts: 864



View Profile
« Reply #5 on: January 16, 2013, 11:57:16 AM »

Quote
What shells are you trying to use? What OS and version of IIS are you using?
Microsoft Windows 2000 SP4
Microsoft IIS httpd 5.1
Using ASPshell and zephir4 (tried 3 or 4 others that I don't remember)

But I am not really looking for help to debug this problem. I am more looking at a methodology or links with tricks I could try.

I have already tried something like 25 differents tricks (not all listed here, obviously), but I would like to learn a few other ones.

I might write my own ASP shell code tonight or modify an existing one...

Logged

OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
ajohnson
Recruiters
Hero Member
*
Offline Offline

Posts: 1057


aka dynamik


View Profile WWW
« Reply #6 on: January 16, 2013, 10:34:44 PM »

Methodology-wise, I'd skip the fancy shells and just see if a basic script works. Something like executing the the value of a GET variable called cmd and output it to the screen. The web service account should at least be about to output a directory listing. If not, there may be something else quirky going on.
Logged

WIP: GCFA | www.infosiege.net | @infosiege

The day you stop learning is the day you start becoming obsolete.
ajohnson
Recruiters
Hero Member
*
Offline Offline

Posts: 1057


aka dynamik


View Profile WWW
« Reply #7 on: January 17, 2013, 09:20:43 AM »

Also, remember that you can use msfpayload/msfencode or msfvenom to create asp files that contain Meterpreter, reverse shells, etc.
Logged

WIP: GCFA | www.infosiege.net | @infosiege

The day you stop learning is the day you start becoming obsolete.
H1t M0nk3y
Hero Member
*****
Offline Offline

Posts: 864



View Profile
« Reply #8 on: January 17, 2013, 10:16:43 AM »

I didn't know that.
I will play with this later today.

Thanks ajohnson
Logged

OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
ajohnson
Recruiters
Hero Member
*
Offline Offline

Posts: 1057


aka dynamik


View Profile WWW
« Reply #9 on: January 17, 2013, 10:33:07 AM »

This tutorial uses WebDAV as the delivery mechanism, but shows how to create the asp file, which works regardless of how you get it up to the web server: http://carnal0wnage.attackresearch.com/2010/05/more-with-metasploit-and-webdav.html
Logged

WIP: GCFA | www.infosiege.net | @infosiege

The day you stop learning is the day you start becoming obsolete.
H1t M0nk3y
Hero Member
*****
Offline Offline

Posts: 864



View Profile
« Reply #10 on: January 17, 2013, 12:12:10 PM »

I appreciate it ajohnson. Thanks
Logged

OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
H1t M0nk3y
Hero Member
*****
Offline Offline

Posts: 864



View Profile
« Reply #11 on: January 18, 2013, 11:09:43 AM »

As an update, the Meterpreter as an ASP payload did the trick.

Other useful information related to this subject:
http://www.ethicalhacker.net/component/option,com_smf/Itemid,54/topic,9169.0/
http://www.ethicalhacker.net/component/option,com_smf/Itemid,54/topic,5966.msg31666/#msg31666
http://www.room362.com/blog/2012/8/25/post-exploitation-command-lists-request-to-edit.html

Thanks again!
Logged

OSCP, GPEN, GWAPT, GSEC, CEH, CISSP
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.069 seconds with 23 queries.
 
Exclusive Deal

sansfire13_245x90_cw90.jpg
SANSFIRE 2013
June 15 - 22

5% Off w/ Code: EHN_5

SANS Deals 4 EH-Netters
5% OFF Any SANS Course in Any Format!
Coupon Code: EHN_5 Including SANS Rocky Mountain 2013 & SANS Boston 2013
Polls
Compared to this year, 2013 will be:
 
Recent Forum Topics
EH-Net News Feeds
Latest Additions
 
         
Advertisement

© 2013 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.