Lab11 - Code Forensics, Tunneling
Lab11 - Code Forensics, Tunneling
Lab11 - Code Forensics, Tunneling
• Understand the lack of protection that .NET and Java have with code protection.
• Investigate methods of obfuscation of code.
• Create Microsoft .NET code in order to investigate a host.
• Analyse a ransomware evidence bag.
Lab demo:
http://www.youtube.com/watch?v=x1jhSIo-GoI
namespace simple {
class simple {
private static void Main(string[] args) {
string s;
System.Console.Write("What is your name?");
s = System.Console.ReadLine();
System.Console.WriteLine("Hello " + s);
}
}
}
A.2 Compile the program, and program and make sure that that it works. From the
command prompt you can compile it with:
csc simple.cs
Note: To compile a .NET 2.0 program, you can access the compiler from:
c:\windows\Microsoft.NET\Framework\v2.0.50727\csc.exe
http://asecuritysite.com/exemplar.zip
1
http://asecuritysite.com/ob.zip
A.5 Go into the /obfuscated folder, and copy the obfuscated EXE into the home
folder. Show that the EXE is now obfuscated.
Which options in the obfuscator changes the names of the variables to non-
printing characters?
using System;
namespace simple {
class simple {
System.Console.Write(s);
s = System.Console.ReadLine();
if (s=="London")
{
System.Console.WriteLine("Correct");
}
else
System.Console.WriteLine("Incorrect");
System.Console.WriteLine("Result is: "+Convert.ToString(calc(val1,val2)));
2
Now download ILSPY from:
http://ilspy.net/
Now obfuscated your EXE with the following options and observe the changes in ILSPY:
ob.exe NT /src=simple.exe
ob.exe 9 /src=simple.exe
ob.exe 8 /src=simple.exe
javac sample.java
If your system does not find the Java compiler you can normally run from a folder on your system, such
as:
A.8 Finally download JAD, and try and decompile the byte code. Prove that you
can reverse the code. The download for JAD is at:
http://asecuritysite.com/jad.zip
3
Using Google, which packages can be used to obfuscate Java class files?
Ransomware Analysis
The following page contains an evidence bag for the Cerber ransomware. Complete the tutorial:
https://asecuritysite.com/subjects/chapter87
f = open("1111.jpg", "rb")
try:
byte1 = hex(ord(f.read(1)))
byte2 = hex(ord(f.read(1)))
if (byte1=='0xff' and byte2=='0xd8'):
print 'JPEG'
finally:
f.close()
http://asecuritysite.com/evidence.zip
Now, using your Python program, see if you can match the magic number, and then change the file
extension, and see if you can view them.
file02
file03
file04
file05
file06
5
file07
file08
file09
file10
file11
file12
file13
file14
file15
file16
file17
file18
file19
file20
file21
file22
file23
file24
file25
file26
file27
file28
file29
file30
file32
file33
6
file34
file35
file36
file37
file38
file39
file40
7
Lab 11b: Tunnelling
One of the most challenging areas within detecting a security breach is in tunneling. In this lab we will see some of the challenges.
http://asecuritysite.com/csn11128/nets
Video: https://youtu.be/a-gFpW78IQE
1 Viewing details
No Description Result
1 Go to your Kali Linux instance on the DMZ. Run Wireshark and Your IP address and TCP port:
capture traffic from your network connection. Start a Web
browser, and go to www.napier.ac.uk. Napier’s Web server IP address and TCP port:
Stop Wireshark and identify some of your connection details: Right-click on the GET HTTP request from the client, and follow
the stream:
Can you read the HTTP requests that go from the client to the
server? [Yes][No]
2 Go to your Windows 2003 instance on the DMZ. Run Wireshark Your IP address and TCP port:
and capture traffic from your network connection. Start a Web
browser, and go to www.napier.ac.uk. Napier’s Web server IP address and TCP port:
Stop Wireshark and identify some of your connection details: Right-click on the GET HTTP request from the client, and follow
the stream:
8
What does the red and blue text identify?
Can you read the HTTP requests that go from the client to the
server? [Yes][No]
9
4 Go to your Windows 2003 instance. Run Wireshark and capture
traffic from your network connection. Start a Web browser, and go Your IP address and TCP port:
to https://twitter.com.
Twitter’s Web server IP address and TCP port:
Stop Wireshark and identify some of your connection details:
Which SSL/TLS version is used:
10
2 OpenSSL
No Description Result
1 Go to your Kali Linux instance, and make a connection to the
www.live.com Web site: Which SSL/TLS method has been used:
openssl s_client -connect www.live.com:443 Which encryption method is used for the tunnel:
2 Now, add the –ssl3 option and note the changes: Which SSL/TLS method has been used:
11
Determine the following for these sites:
Site Protocol Encryption type Enc key length Hash method Public key size Cert Issuer
[Intel] TLSv1 RC4 128-bit SHA-1 2,048 Cyber Trust
[Adobe]
[Symantec]
[Reddit]
[Wordpress]
[LinkedIn]
[Yahoo]
[Wikipedia]
[Barclays]
[Asecuritysite.com]
https://it4kb.wordpress.com/2014/06/11/iis-crypto/
Then scan the following sites using the Qualys SSL Lab URL test:
12
Site Crypto methods used and weaknesses identified Grade (A, B, C…)
google.com
Microsoft.com
asecuritysite.com
What advice would you give each of these companies for the setup of their site?
sudo apt-get install apache2 Can you connect from Kali to your local host with:
sudo a2enmod ssl
sudo a2ensite default-ssl
https://localhost
sudo openssl req -new -x509 -days 365 -sha1 -newkey
rsa:1024 -nodes -keyout server.key -out server.crt
Can you connect to your Kali instance from a Web browser on
sudo /etc/init.d/apache2 restart Windows 2003:
13
https://10.200.0.x
[Yes][No]
2 On Kali, now download the following Python script to detect Is your server vulnerable?
Heartbleed:
http://asecuritysite.com/heart.zip
3 On Wireshark, now repeat 2, and capture data packets. Which SSL/TLS method has been used:
14
4 Examine the Python script. Can you identify the place where the Python scripts crafts the
Heartbleed packet (Look for “18 03 01 00 03 01 40 00”)?
What does the “40 00” identify and by looking at the packets in the
previous step, can you determine what is missing from the
Heartbleed packet:
4 Now we will use Snort to detect a Heartbleed packet. On Windows Does Snort detect the Heartbleed packet: [Yes][No]
2003, create a Snort use which detects 18, 03, 02 and 00:
15
4 Examining traces
No Description Result
1 Download the following file, and examine the trace with
Wireshark: Client IP address and TCP port:
16
3 Download the following file, and examine the trace with Which is the IP address of the client and of the server:
Wireshark:
http://asecuritysite.com/log/ipsec.zip Which packet number identifies the start of the VPN connection
(Hint: look for UDP Port 500):
Determine one of the encryption and hashing methods that the client
wants to use:
Now determine the encryption and hashing methods that are agreed
in the ISAKMP:
17