Tuesday, May 14, 2013

Fight against Cyber criminals' advance malware threat



Damballa® Failsafe, in today’s network environment could be seen as a parallel  'last line of defense' where prevalent security solutions remain hand-cuffed with their known limitations.

Malwares can be broken into categories :

1. Opportunistic and Distributed: These malwares are distributed geographically by various means like traveling-USB(s), dongles, web-downloads(drive-by), malware app like online AV-scan, lottery and money scams etc.
2. Targeted : This is primarily an attempt to focus on marked target, reconnaissance, gather all info, testing analysis, intrude, exploit, ex-filtrate. This is an idea and malware is mere a delivery vehicle. Zero-day malware are one of such type.

Cyber threats’ stages and behaviors:

As the advance threats become more resilient , multi-tiered, focused on survivability, we see them following certain style which is inevitable for their hidden functioning:

Stages to compromise:
1. Recon: Analysis about the target through physical, telephonic, malware-pinching techniques. Cyber criminals do deep study/analysis of the applications/ protocols/ network architecture of the target before invading them.
2. Weaponization: Once the infiltration mechanisms are devised, the droppers are tested to get into the endpoints/servers.
3. Cyber contents either might lure the internal user to open connections which helps penetrate Firewalls/IPS or through sophisticated methods malware will be injected via injection vectors manually. This is known as delivery stage.
4. Exploitation: The dropped malware attaches itself to important OS process to evade being caught at endpoints levels. Like for ex: attaching itself to TCP/IP and NDIS processes where in sniffing tools fails to capture malware hidden packet movements.
* Some malwares, before behaving ensures that they are not being run on VMs, sandbox or where the machine is not to be operated by human being.

Stages leading to business loss, functional/operational loss & brand value loss:
5. Command & Control communication: The dropped malware escalates its privileges to establish CnC for updates of new-codes(to avoid any possible AV detection), new instructions, to forward sensitive data etc.
6.Exfiltrate: This is the last stage, if successful causes huge loss.  This stage ends with malware destroying itself so as to be not caught and can be used again.

Remember, on an average there is a gap of nearly 6 months before the advance malwares are detected.


AV/HIPS, N-IPS/N-IDS, Firewalls, Web security appliances, DLP has limitations(false sense of security against adv. malwares):
1. Antivirus relies on signature to match malwares. A must on all endpoints to meet compliance and protection against known threats but is no-where when comes to unknown threats.
2. Intrusion Prevention System relies on signature/heuristics, anomalies & SPA(protocol profiling, not a true sense DPI). Majorly built to protect against attacks on Operating systems, TCP/IP stack, servers and systems. These threats exploiting at L3/L4 and L7 were addressed but advance threats at L7 which comes in stages and uses the genuine code structure of such protocols do get to perforate inline-IPS. It doesn't save administrators from false-positives & requires baseline for anomalies, not an ache for malwares.
3. Firewall(Network) does packet filtering/inspection and may use application layer intelligence but often suffer from the problem with true sense DPI. There are many genuine app often not adhering to RFC compliance. Attackers might infect such non RFC compliant apps to infect the endpoints.
Next gen malware easily absorbs advantage of state-ful connections and its rapidly changing behavior takes exception to FW policies. UTM solutions which pulls endpoint protection at network layer, but is not at pace of dynamically changing behavior of advance malware.
4. Web security & content filtering, like proxy using black/white list doesn't keep up with DNS fluctuation. Non-browser traffics by-passes proxies to establish CnC communication.
5. DLP helps in data leak/loss inadvertently/on purpose. It doesn't protect against data theft. Advance malwares forwards/steal interesting data by changing the data there by evading scripts/categories of host/network based DLP so that it may not look like business related information. One way is by modulating the data info into sound bites and then demodulating it(can be achieved via .dll file). Malwares opening a backdoor on SSL is beyond understanding of above technologies.
Verizon ‘Data Breach Incident Report’, 2011 states that 28% of Data breaches occurred due to advance malware/targeted attacks.



Damballa® Failsafe automates the discovery of your organization’s highest risk devices under criminal control. Damballa Failsafe provides:
1. Protection against unknown and hidden threats. Earliest possible threat discovery (by means of DNS queries (like fast fluxing and domain fluxing) which targeted malwares uses to update & receive instructions, by DPI of the packet to see non/executables, pdf, binaries etc. Failsafe distinguishes for automated and human driven behavior to look for malware behavior).
2. Protection for any endpoint device.
3. Actionable intelligence for rapid and prioritized incident response with complete forensic analysis.
4. Protection from new and emerging threats in the beginning of malicious communication so you don't have to wait till your IP/sensitive data is at stake.
5. An easy and automated solution for fighting advanced threats.
6. Being out-of-band it remains out of sight of cyber criminals while at any/reconnaissance phase. Addresses and stops malicious malware communication with very high rate of true positive so your security experts concentrate on genuine cyber threats.


Note: Damballa doesn't compete with layered security solutions as discussed above, rather, it address the limitations imposed on their functionality by their means of definition & use.

Wednesday, March 27, 2013

BGP Load balacing mechanism:



BGP when runs always rely on some IGP running protocol like dynamic protocols like OSPF, EIGRP  or static and connected routes.

So BGP forwards packet by destination network learned via BGP next hop + the route to reach that next hop with some interior gateway protocol.

1. EBGP does load balacing if it has two or more path to reach the destiantion prefix, provided the peering is done on loopback interfaces. This is like having two static routes to a peer leading to destination network. This has to be in consideration with AS PATH. MED, Local PREF , weight values being equal. The path attributes can spoil LB if not matching.
2. EBGP multipath commands allow to load balance on the number of path given & available.
3. IBGP does loadbalacing on underlying protocol. Like eigrp does equal cost path LB and unequal cost path LB.
4. If the BGP learned destination's next hop is learned on a network which connects over port channel using LACP/PAgP etc. then the channel portocol will load balance/share the packets with channeling mechanism
5. Still if a destination on BGP is learned via a HOP, & the HOP is reachable via static route, & if flow switching is working then one link will be used to flow switch the traffic that matches src/dst IP / port criteria.
6. If a route/HOP is reachable via CEF then CEF could use per src/dst IP, src/dst port & per packet load balancing. Per packet LB has its caveats for other layers of network functional devices; like a firewall may see this as an attack if two packets are learned from different interfaces with same source just because that destination is reachable on equal cost .

Wednesday, February 6, 2013

Designing best and next best path for a network within OSPF area



This is an example of choosing best path to reach network 100.100.100.1/32 Loopback on R4 from R1.

Note: Within an area LSDB or topology table remains synchronized and identical so no manipulation can be done. But distribute-list could be used while installing routes from topology table to Routing table.

 

By default the cost to reach Lo1 100.100.100.1 on R4 from R1 will be 64+1+1.
R1 has two best equal cost path via R1->R2->R4->Lo1 or  R1->R3->R4->Lo1.
Objective:
To reach network Lo1 on R4 we want only one path either, or both the path with any one being best and second path alternative should the primary fail.



R1(config-router)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/30 is subnetted, 1 subnets
O       1.1.1.0 [110/65] via 2.2.2.2, 00:02:59, Serial0/0
     2.0.0.0/30 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Serial0/0
     100.0.0.0/32 is subnetted, 1 subnets
O  100.100.100.1 [110/66] via 2.2.2.2, 00:02:59, Serial0/0    //**two best path

                             [110/66] via 3.3.3.2, 00:02:59, Serial0/1
     3.0.0.0/30 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Serial0/1
     101.0.0.0/32 is subnetted, 1 subnets
O       101.101.101.1 [110/66] via 2.2.2.2, 00:03:00, Serial0/0
                                 [110/66] via 3.3.3.2, 00:03:00, Serial0/1
     4.0.0.0/30 is subnetted, 1 subnets
O       4.4.4.0 [110/65] via 3.3.3.2, 00:03:03, Serial0/1


To make R1->R2->R4->Lo1 as best path we will use distribute list gateway command on ospf

On R1:
interface Serial0/0
 ip address 2.2.2.1 255.255.255.252
 clock rate 2000000
!
interface Serial0/1
 ip address 3.3.3.1 255.255.255.252
 clock rate 2000000
!

//** using prefix list by distribution-list below, the Lo1 100.100.100.1 learned from S0/1 interface of R1 has been disallowed to go to the RIB.

router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
 distribute-list prefix FILTER_PREFIX gateway DENY1 in Serial0/1
 !
ip prefix-list DENY1 seq 5 permit 3.3.3.2/32

!

ip prefix-list FILTER_PREFIX seq 5 deny 100.100.100.1/32

ip prefix-list FILTER_PREFIX seq 7 permit 101.101.101.1/32
!

But the above has a disadvantage with regard to if the primary path fails at any stage the backup S0/1 on R1 will still filter the Lo1 route from being installed and thus the access to Lo1 will remain dead.

Second option is,

I have not discovered as yet any way to change the cost when R1 learns about Lo1 from R4. Tried multiple ways to change the metric via route map, also tried tagging the route at R3 and then modify the metric value on R1 via route-map set metric +/- but the output was not any better.

One more option just worked out. Within an area changing AD is the nicest way to manipulate the likelihood to become the best path. But modifying AD on R1 changes the AD for all route learned via R1 source.
R1(config-router)#distance 109 2.2.2.1 0.0.0.0   //*will change AD globally for a source

We can manipulate AD when it traverses from one process to another and that just seems to work out.

On R3:

interface FastEthernet0/0
 ip address 4.4.4.1 255.255.255.252
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 3.3.3.2 255.255.255.252
 clock rate 2000000
!
router ospf 1
 log-adjacency-changes
 redistribute ospf 2 subnets tag 51          //** tagging is done for reference to check on R1
 network 3.3.3.0 0.0.0.3 area 0
!
router ospf 2
 log-adjacency-changes
 redistribute ospf 1
 network 4.4.4.0 0.0.0.3 area 0
!
Since R3 has OSPF process 1 for 3.3.3.0 R1 link and OSPF domain process 2 for 4.4.4.0 R4 link, it will not share each other routes as the processes behaves. We will redistribute them into one another.

Note: Redistribution of subnets are often the cause of loop in OSPF as it breaks broad visibility of OSPF domain. Perform it carefully.
 
At this point on R1 the we could see the route for Lo1 100.100.100.1 is learned as external, since it moved from OSPF process 2 to OSPF process 1 on R3, ignore R2 as of now.

For OSPF path preference is intra-area, then Inter-area , then External routes.

Add the below command  on R1

router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
 distance ospf external 111               //** change the AD of external route learned from ospf process 2                                                        on R3 to 111.

Now under normal scenario R1->R2->R4->Lo1 will have intra-area AD 110 and if it fails the R1->R3->R4->Lo1 which has two ospf process will have AD 111. 

This way R1 has two paths to reach Lo1 by manipulating their AD value with an OSPF area.

Lets Check on R1:

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/30 is subnetted, 1 subnets
O       1.1.1.0 [110/65] via 2.2.2.2, 00:35:09, Serial0/0
     2.0.0.0/30 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Serial0/0
     100.0.0.0/32 is subnetted, 1 subnets
O       100.100.100.1 [110/66] via 2.2.2.2, 00:35:09, Serial0/0   //**Intra-area path preferred
     3.0.0.0/30 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Serial0/1
     101.0.0.0/32 is subnetted, 1 subnets
O       101.101.101.1 [110/66] via 2.2.2.2, 00:35:09, Serial0/0
     4.0.0.0/30 is subnetted, 1 subnets
O       4.4.4.0 [110/66] via 2.2.2.2, 00:35:10, Serial0/0


Now I will shut down the f0/0  on R4:


Lets see now if R1 has next best path to reach Lo1 100.100.100.1

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/30 is subnetted, 1 subnets
O       1.1.1.0 [110/65] via 2.2.2.2, 00:00:16, Serial0/0
     2.0.0.0/30 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Serial0/0
     3.0.0.0/30 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Serial0/1
     100.0.0.0/32 is subnetted, 1 subnets
O E2    100.100.100.1 [111/2] via 3.3.3.2, 00:00:14, Serial0/1 //** external path is active now
    101.0.0.0/32 is subnetted, 1 subnets
O E2    101.101.101.1 [111/2] via 3.3.3.2, 00:00:14, Serial0/1
     4.0.0.0/30 is subnetted, 1 subnets
O E2    4.4.4.0 [111/1] via 3.3.3.2, 00:00:16, Serial0/1

Cheers!


Sunday, February 3, 2013

IPsec within IPsec: Double tunnel site to site

The below example forms a site to site ipsec tunnel between R1 and R2.
Once configured one more tunnel is formed between R4 and R3.

R1 & R2 encapsulates encrypted packet for internal LAN represented by R4 2.2.2.0 and R3 3.3.3.0 subnet.
So, R4 to R3 tunnel goes encrypted with R1 R2 tunnel.


R1 Config:
crypto logging session
!
crypto isakmp policy 1
 encr aes 256
 hash md5
 authentication pre-share
 lifetime 300
crypto isakmp key CHAMP address 1.1.1.2 255.255.255.0
!
!
crypto ipsec transform-set TS esp-des esp-sha-hmac
crypto mib ipsec flowmib history failure size 100
!
crypto map mapme 1 ipsec-isakmp
 description tunnel2
 set peer 1.1.1.2
 set security-association replay window-size 1024
 set transform-set TS
 match address 101
 qos pre-classify
!
!
!
interface FastEthernet0/0
 ip address 2.2.2.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 1.1.1.1 255.255.255.0
 duplex auto
 speed auto
 crypto map mapme
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
ip route 3.3.3.0 255.255.255.0 1.1.1.2
ip route 200.200.200.0 255.255.255.0 FastEthernet0/1
!
ip http server
no ip http secure-server
!
access-list 101 permit ip 2.2.2.0 0.0.0.255 3.3.3.0 0.0.0.255


R2 Config:

crypto logging session
!
crypto isakmp policy 1
 encr aes 256
 hash md5
 authentication pre-share
 lifetime 300
crypto isakmp key CHAMP address 1.1.1.1 255.255.255.0
!
!
crypto ipsec transform-set TS esp-des esp-sha-hmac
crypto mib ipsec flowmib history failure size 100
!
crypto map mapme 1 ipsec-isakmp
 description tunnel2
 set peer 1.1.1.1
 --More--          set security-association replay window-size 1024
 set transform-set TS
 match address 101
 qos pre-classify
!
!
!
interface FastEthernet0/0
 ip address 1.1.1.2 255.255.255.0
 duplex auto
 speed auto
 crypto map mapme
!
interface FastEthernet0/1
 ip address 3.3.3.1 255.255.255.0
 duplex auto
 speed auto
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
ip route 2.2.2.0 255.255.255.0 FastEthernet0/0
ip route 200.200.200.0 255.255.255.0 FastEthernet0/1
!
no ip http secure-server
!
access-list 101 permit ip 3.3.3.0 0.0.0.255 2.2.2.0 0.0.0.255
!

R3 Config:

crypto isakmp policy 10
 encr 3des
 authentication pre-share
 group 5
crypto isakmp key CHAMEY address 2.2.2.1 255.255.255.0
!
!
crypto ipsec transform-set TS esp-3des esp-md5-hmac
!
crypto map mapme 1 ipsec-isakmp
 set peer 2.2.2.1
 set transform-set TS
 match address 101
!
!
 --More--         !
interface Loopback1
 ip address 200.200.200.200 255.255.255.0
!
interface FastEthernet0/0
 ip address 3.3.3.2 255.255.255.0
 duplex auto
 speed auto
 crypto map mapme
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
!
ip http server
no ip http secure-server
!
access-list 101 permit ip host 200.200.200.200 192.168.1.0 0.0.0.255

R4 Config:

crypto isakmp policy 10
 encr 3des
 authentication pre-share
 group 5
crypto isakmp key CHAMEY address 3.3.3.2 255.255.255.0
!
!
crypto ipsec transform-set TS esp-3des esp-md5-hmac
!
crypto map mapme 1 ipsec-isakmp
 set peer 3.3.3.2
 set transform-set TS
 match address 101
!
!
!
interface FastEthernet0/0
 ip address 2.2.2.1 255.255.255.0
 duplex auto
 speed auto
 crypto map mapme
!
interface FastEthernet0/1             //* F0/1 connects to cloud which connects to my  LAN adapter
 ip address 192.168.1.35 255.255.255.0 
 duplex auto
 speed auto
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 FastEthernet0/1            
ip route 1.1.1.0 255.255.255.0 FastEthernet0/0
ip route 3.3.3.0 255.255.255.0 FastEthernet0/0
ip route 200.200.200.0 255.255.255.0 FastEthernet0/0

!
ip http server
no ip http secure-server
!
access-list 101 permit ip 192.168.1.0 0.0.0.255 host 200.200.200.200
!



We will discuss in detail IPsec later in series....
I hope you tried it and had fun learning it!

-Anupam

Thursday, January 31, 2013

Understand VLAN like never before!!

I consider vlan to be a dome like structure in a real world. What will happen if 10 people i.e. human beings are left in a closed dome like structure a.k.a vlan. Yeah, probably they all will survive with food and O2 and they can also talk to each other & share their GF-BF stories.


But the question is why they are able to talk to each other; probably they are all humans and so they understand each other Or probably they are all English speaking dudes. Good. Lets call all these English speaking dudes originated from same family. Can we call them 1 family, OR 1 LAN members common to them all is ENGLISH.

So morally all English speaking dudes can talk to each other in a dome closed structure. Now, assume we add two more people in that dome that adds up to total strength being 12 now. Unfortunately, those two speak only either Hindi or Chinese. Will the 10 English dude be able to talk to and understand those 2 Hindi/Chinese or vice-versa?? Naaaaah!!! Not until some a 1000 years evolution or a new paradigm change on the way they express themselves.

This is like a situation where 10 people in a LAN who all understand English can't talk to 2 people who only understand either Hindi or Chinese. Can we say those 2 are not in a family or VLAN despite being in that dome. Now if you replace those 10 people with a network address in 10.10.10.0 255.255.255.0 and assign them IP from 10.10.10.1 -10 they all will talk to each other beautifully. Eventually the Chinese/Hindi guys will be member of a different family say 10.10.20.0 255.255.255.0 and are deprived of any communication between the two families.

Now , suppose there is one more dome number 2 parallel to above dome number 1. Here we have 2 domes in total but since both are unique independent closed structure, people from dome 1 and 2 can't talk to each other. Assuming there are 10 English speaking people & 2 Chinese/Hindi Speaking  in dome 2 as well, it means it is exact replica of dome 1.
Now the 10 english speaking from dome 1 can't talk to 10 english speaking people in dome 2 & similary from the 2 chinese/Hindi speaking chaps.

What if I create a HOLE in Dome 1 & Dome 2 connecting it through a rubber tube of a Tyre. But the privilege is that the HOLE was created by English people on both the sides so they own the rubber tube/tunnel to communicate with the other side.

The two Chinese/Hindi in both the domes 1/2 won't be able to pass their words to each other since they don't have any hold on the tunnel nor do they have money to dig on their own.

Supposedly, one night the 2+2 Chinese/Hindi speaker on both side got some money miraculously and dug a HOLE which they own. Now 2 Chinese/Hindi Speaking can talk to each other through their independent HOLES( in their respective domes) which they own.

These two independent HOLES( connected via tube)  created by both the Englishmen and the CHINESE/HINDI speaker can be called two ports belonging to two vlans or to two different family.

One day one storm hits both the domes and ENGLISHMEN lose their rubber tube tunnel, therefore, the communication between dome 1 and dome 2 English guys snapped. They were drawing a plan to create more domes but lost contact after the storm passe but the 2 CHINESE/HINDI speaker's tunnel is intact and OK.

For the time being ENGLISHMEN used their policy and offered pizzas to the 2 CHINESE/HINDI speaker's in lieu to use their tunnel for their communication. Since 2 CHINESE/HINDI speaker's got something new for their taste-buds they agreed to share the rubber tube tunnel with the 10 ENGLISHMEN on both the sides.

This way both sides could talk to each other happily without any further disruptions. This common use of tube can be called a trunk which carries information for both the ENGLISHMEN& CHINESE/HINDI family or vlans.

I hope you enjoyed the story and had fun imagining it.

Good Luck!


-Anupam






IP accounting - Cisco Press


Read IP accounting, though not used much these days, but a nice feature on security and inspection level.

Uses:

1. IP accounting L3, which is configured only on outbound and doesn't take into account the traffic terminating or originating on the router itself. Maintains Acitve and Checkpoint database to store the history and active traffic logs,

2. IP Accounting ACL checks the traffic which doesn't match any specific acl. A range of IP address can be provided. Can be put on both ingress and egress ports. Keep incrementing the hits for a subset of address. Collected data is accessible via CLI and SNMP; however, the initial configuration is required via CLI. To retrieve the collection results via SNMP, you need to enable SNMP on the router first. When configuring SNMP, distinguish between read-only access and read-write access.

3. IP accounting MAC for LAN etc. Best for usage billing per IP id per customer. Has only active logs visual feature

4. IP Accounting Precedence: provides IP precedence-related traffic accounting information. The collection per interface consists of the total number of packets and bytes for each of the eight IP Precedence values, separately per direction (send and receive).Sub-interfaces can be helpful for per user.

Link to IP accounting by Cisco Press

Good Luck!