03 Preparing and Defending Against Exploitation
03 Preparing and Defending Against Exploitation
S e c t i o n 0 3 | M o d u l e 0 3
© Caendra Inc. 2019
All Rights Reserved
Table of Contents
Exploitation:
Definition
Exploitation
Techniques & Defense
• BGP Hijacking
• Passive & Active Sniffing
• Remote Exploits
• NetNTLM Hash Capturing & Relaying
• Remote Linux Host Attacks
• Remote Denial of Service Attacks
• Malicious Macros
To get a better idea of how this attack works. You first need
to understand what BGP is and how it works.
Another example (refer to the image on your right) might be the case
of routers in AS 3 receiving BGP information regarding 80.56.0.0/24
from a rogue router in AS 4. Being both a more specific prefix and a
shorter AS path, they would wrongly route IP information destined to
the 80.56.0.0/24 prefix through AS 4.
Source: https://cyberstartupobservatory.com/ip-hijacking
https://www.cisco.com/c/en/us/support/docs/ios-nx-os-software/ios-software-releases-121-
mainline/12778-ping-traceroute.pdf
IHRPv1 - Caendra Inc. © 2019 | p.14
3.2.2 Passive & Active Sniffing
https://www.monkey.org/~dugsong/dsniff/
http://www.oxid.it/cain.html
http://sniff.su/download.html IHRPv1 - Caendra Inc. © 2019 | p.17
3.2.2 Passive & Active Sniffing
https://moxie.org/software/sslstrip/
IHRPv1 - Caendra Inc. © 2019 | p.22
https://github.com/moxie0/sslstrip
3.2.2.1 SSL Stripping
Replaces the HTTPS links with HTTP clone links and remembers the links which were changed
Communicates with the victim client over HTTP connections for any secure link
Communicates with the legitimate server over HTTPS for the same secure link
The sslstip attacker machine transparently proxies the communications between the victim and the server
Favicon images are replaced with the known "secure lock" icon to provide familiar visual confirmations
Sslstrip logs all traffic passing through so passwords, credentials etc. are stolen without the victim knowing
http://www.slideshare.net/Fatuo__/offensive-exploiting-dns-servers-changes-blackhat-asia-2014
https://github.com/singe/sslstrip2
https://github.com/byt3bl33d3r/MITMf IHRPv1 - Caendra Inc. © 2019 | p.29
3.2.2.1.1 sslstrip+
Detection Tip
https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-
settings/network-security-restrict-ntlm-outgoing-ntlm-traffic-to-remote-servers IHRPv1 - Caendra Inc. © 2019 | p.48
3.2.4 NetNTLM Hash Capturing & Relaying
Detection
Password spraying attacks can be potentially detected through
log/event analysis.
Detection
-N was used since anonymous access to the
share was allowed (no password is
The attacker finally accesses the required)
available “tmp” share. Notice that this
time a new directory named “rootfs” smbclient \\\\192.168.13.29\\tmp -N
Detection
Detection
Detection
Detection
• By inspecting Bro’s conn.log defenders can
spot the RMI upload (131.243.xxx.xxx hosts
the Java RMI Registry service)
• Right after the RMI upload, defenders can
see the machine hosting the Java RMI
Registry service communicating with a
remote machine (209.112.253.167) over
port 8080
• By consulting with Bro’s http.log defenders
can identify that a .war file was uploaded
and right after that, communication was
established with the remote machine we
identified in Bro’s conn.log
(209.112.253.167)
Source: https://www.zeek.org/brocon2015/slides/sharma_p0wnage.pdf
https://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability
https://nytrosecurity.com/2018/05/30/understanding-java-deserialization/
IHRPv1 - Caendra Inc. © 2019 | p.85
3.2.5.6 Exploiting Insecure Java Deserialization
Detection
Detection
alert tcp any any -> $HOME_NET any (msg:" ETPRO EXPLOIT Serialized Java Object Calling Common Collection Function"; flow:to_server,established;
content:"rO0ABXNyA"; content:"jb21tb25zLmNvbGxlY3Rpb25z"; fast_pattern; distance:0; reference:url,github.com/foxglovesec/JavaUnserializeExploits;
classtype:misc-activity; sid:2814811; rev:1;)
alert tcp any any -> $HOME_NET any (msg:" ETPRO EXPLOIT Serialized Java Object Calling Common Collection Function"; flow:to_server,established;
content:"|ac ed 00 05 73 72 00|"; fast_pattern; content:"commons.collections"; nocase; distance:0;
reference:url,github.com/foxglovesec/JavaUnserializeExploits; classtype:misc-activity; sid:2814812; rev:1;)
alert tcp any any -> $HOME_NET any (msg:" ETPRO EXPLOIT Serialized Java Object Generated by ysoserial"; flow:to_server,established; content:"|ac
ed 00 05 73 72 00|"; fast_pattern; content:"java/io/Serializable"; nocase; distance:0; content:"ysoserial/payloads/util/Gadgets";
reference:url,github.com/foxglovesec/JavaUnserializeExploits; classtype:misc-activity; sid:2814813; rev:1;)
alert tcp any any -> $HOME_NET any (msg:" ETPRO EXPLOIT Serialized Groovy Java Object Generated by ysoserial"; flow:to_server,established;
content:"|ac ed 00 05 73 72 00|"; fast_pattern; content:"org.codehaus.groovy.runtime.ConversionHandler"; nocase; distance:0;
content:"ysoserial/payloads/util/Gadgets"; reference:url,github.com/foxglovesec/JavaUnserializeExploits; classtype:misc-activity; sid:2814814;
rev:1;)
alert tcp any any -> $HOME_NET any (msg:" ETPRO EXPLOIT Serialized Spring Java Object Generated by ysoserial"; flow:to_server,established;
content:"|ac ed 00 05 73 72 00|"; fast_pattern; content:"org.springframework.core.SerializableTypeWrapper"; nocase; distance:0;
content:"ysoserial/payloads/util/Gadgets"; reference:url,github.com/foxglovesec/JavaUnserializeExploits; classtype:misc-activity; sid:2814815;
rev:1;)
As far as the technical and business parts are concerned the following should be
taken into consideration:
➢ Identify all publicly accessible services
➢ Validate capacity of network equipment
➢ Enumerate areas of dynamic content
➢ Assess vendors
➢ Identify business critical systems
➢ Cost of downtime
➢ Understand overall industry risks
On-premises mitigation hardware against (D)DoS attacks, like traditional and “next-gen” firewalls, web
application firewalls (WAF), intrusion prevention/detection systems (IPS/IDS), purpose-built (D)DoS mitigation
appliances and load balancers, should be in place as a first line of defense.
As a second layer of defense against (D)DoS attacks, utilization of the following mitigation solutions is
recommended:
➢ ISP blocking and “clean pipes”
➢ Content delivery network (CDN) as a (D)DoS mitigation platform
➢ (D)DoS traffic scrubbing service
➢ Source address rate limiting
➢ Protocol rate limiting
➢ Anomaly detection
➢ Utilization of a HTTP/S JavaScript challenge
➢ Reputation data
➢ Sinkholes against (D)DoS attacks (Blackhole Routing)
Detection
It should be noted that the above is true only if Office is deployed with its default macro
settings (disable macros and show notification).
Detection
As already mentioned the TrustRecords key
contains the full path to each document. For
each trust to be maintained though, additional
information is required. This is why each trust
record contains not only the full path of the
associated document, but also a binary blob
containing information about both the trust and
the action that triggered the creation of the
record.
Detection
Source: https://www.cqure.nl/kennisplatform/hunting-for-evil-detect-macros-being-executed
dsniff
https://www.monkey.org/~dugsong/dsniff/
Intercepter-NG
http://sniff.su/
sslstrip
https://github.com/moxie0/sslstrip
preload lists
https://code.google.com/p/chromium/codesearch#chromium/src/net/http/transport_security_s
tate_static.json
sslstrip+
https://github.com/singe/sslstrip2
XSS
https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
UNC path
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dfsc/149a3039-98ce-
491a-9268-2f5ddef08192
THC-Hydra
https://github.com/vanhauser-thc/THC-Archive/tree/master/Tools
Samba
https://www.samba.org/
CVE-2007-2447
https://www.rapid7.com/db/modules/exploit/multi/samba/usermap_script
smbmap
https://github.com/ShawnDEvans/smbmap
samba_symlink_traversal
https://www.rapid7.com/db/modules/auxiliary/admin/smb/samba_symlink_traversal
Shellshock: All you need to know about the Bash Bug vulnerability
https://www.symantec.com/connect/blogs/shellshock-all-you-need-know-about-bash-bug-
vulnerability
Heartbleed
http://heartbleed.com/
RFC6520
https://tools.ietf.org/html/rfc6520
Private Key
https://info.ssl.com/faq-what-is-a-private-key/
TrustRecords
http://az4n6.blogspot.com/2016/02/more-on-trust-records-macros-and.html