AppSec USA 2014 
Denver, Colorado 
Hacking .NET/C# Applications: 
Defend By Design 
Jon McCoy 
DigitalBodyGuard
What is a Defendable System 
What is a Strong/Weak Design 
How to view a Software System 
This Speech
Thanks To 
Thanks AppSec/OWASP 
A Critical part of the security world
Introduction 
Jon McCoy - DigitalBodyGuard 
• Software Engineer 
• Digital Security 
• Application Level Security 
• .NET Framework Expert 
• Attack and Defense
Overview 
Work Area: 
PenTesting and Active Defender 
Specialize: 
.Net Framework Systems
What is a Thick Client? 
GrayWolf 
Demo 
Context
Share What I Have 
Seen 
Context
What is a 
Context 
Defendable API
What is a 
Context 
Defendable API
Focus of this talk 
Daemon 
API 
Service
Focus of this talk 
= =
Focus of this talk 
= =
Focus of this talk 
Daemon 
Business Units 
Service Security 
Network
Client World View
Cyber Attack 
Users 
Web Server 
DB
Client Wants it secure
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
Log
Communications 
Web Service 
SOPE/REST 
Encrypted 
Auth 
Auth 
Web Service 
SOPE/REST 
Encrypted
Unified ModUeMlinLg Language
Network Diagram
Cyber Attack
Critical Units 
Credit Cards 
Production 
DB 
$1,000,000 
$20,000,000 
User Info 
DB 
$100,000
Client Is Strong
Strong
Critical Units 
Credit Cards 
Production 
DB 
$1,000,000 
$20,000,000 
User Info 
DB 
$100,000
A Security Review
Lets say you are “Secure” 
I ”PenTester” will hit you at 
• Network 
• Computer Login 
• Employees 
• Hardware 
• TechSupport 
• ………..
Strong
Lets say you are “Secure” 
I ”The Hacker” will Attack 
• Users 
• Your Physical Infrastructure 
• Your Web-Face 
• All Digital Devices 
• ……….. 
• Except (X/Y/Z)
My Team
A Security Review
On Problem 
Still Good Everything is Bad
Security Review 
• We took full control of Domain Admin 
• We took full control of Network 
• We took full control of Database Systems 
• We took full control of Physical Security 
• We took full control of File Management 
• We took full control of Back Up….. 
• ………..
On Problem 
Everything is Bad
How do we Fix This
Critical Units 
Credit Cards 
Production 
DB 
$2,000,000 
$20,000,000 
User Info 
DB 
$200,000
Layered Defenses 
Credit Cards 
Production 
DB 
$2,000,000 
$20,000,000 
User Info 
DB 
$200,000
Layered Defenses 
Cards Hash 
User Info 
DB 
Credit Cards 
Production 
DB
Layered Defenses 
Cards Hash 
User Info 
DB 
Credit Cards 
Production 
DB
Guards
Quick Recommendations
API Type: 
OWIN.org 
REST – SOPE – Socket 
DB Type: 
Node.JS – Neo4Net 
de Database 
Node Database – Sharding & Segmentation 
Security: 
OAuth (2) 
RSA 4096 – AES 256 – MAC(message authentication code)
Layered Defense 
• Detect and Protect the Perimeter 
• Guard and Respond 
• Build Choke Points 
• Find the Weak Blind Spots 
• …………
“Client Remediates the Issues” 
Client is stronger
Layered Defense
Layered Defense 
Attacking as Hackers
Layered Defense
Security Review 
• We took Admin in 2-4 hours(Tell Client 8 Hours) 
• We took full control of Network 
• We took full control of Database Systems 
• We Failed to control of Physical Security 
• We took full control of File Management 
• We Failed to control of Back Up….. 
• ………..
How do we Fix This
Layered defense 
Detection and Response
Guard Post
Now Security Can Start 
Now we have started 
talking the same 
Language
IT => Developer 
= Pattern 
Anit-Pattern 
Segmentation 
= 
= 
Good Design 
Bad Design 
Separation
Developer => DBA 
Claims 
Facade 
Controllers 
= Authentication 
= 
View 
= 
Actions
Security => Developer 
Security Test 
Attack Vector 
Security Controls 
= Security Unit Test 
Security User Story 
Defendable Systems 
= 
=
Now Security Can Start 
Language = Context
Communications 
Get to know the Client 
Web Data Processing 
Strong API/DAL
Communications 
Data Access Layer
Communications 
Data Access Layer
Communications 
Data Access Layer
Communications
Strong vs Weak 
Software 
DEMO
Communications 
Security Level
Communications 
Security Level
Communications
Communications
Communications 
Domain Expert
Communications
Design Security 
DEMO
Communications 
Two Completely 
POS Different Systems 
Web
Communications 
POS 
Web
Communications 
POS 
Web 
IT/&/Networking 
DB
Teams 
POS != WEB != DB != IT
Mockup Project 
Defend the POS
Communications 
Trusted Network 
Point Of Sales 
Clients & Partners
Communications 
Built 5 Years ago 
Changes Twice a year 
Only X can Access it
Bad Fix
Bandage Security
Communications
Communications 
$250k 
You will prevent 
X/Y/Z Attacks 
Best “Buzzword” Protection
• Turn Key 
• Reliable 
• Low Long Term Cost 
• Free Upgrades for Three Years 
• ……….
Communications
Design Security
Communications
Communications 
Secure System
Communications 
Secure System 
Log System 
Passive Detection
Communications 
API/DAL 
Log 
Detection
Communications 
API/DAL 
Log 
Detection
Communications 
Honey-Pot 
API/DAL 
Log 
Detection
Communications 
Honey-Pot 
API/DAL 
Log 
Detection
Communications 
API/DAL 
Honey-Pot 
Log Detection 
API/DAL
Communications 
API/DAL 
Honey-Pot 
Log Detection 
Data Management & 
Point To Point Crypto 
API/DAL
Communications 
API/DAL 
Honey-Pot 
Log Detection 
Crypto 
Crypto 
API/DAL
Communications 
API/DAL 
Honey-Pot 
Log Detection 
Crypto 
Crypto
Communications 
Segmented 
Network 
POS Auth
Communications 
Data API 
POS 
Auth 
Auth
• Segmented Hardware 
• Segmented User Authentication(NO AD!) 
• Segmented Management 
• Segmented Data Storage/Backup 
• Segmented Buildings 
• Segmented Developers 
• Segmented IT/Security 
• Segmented Power…….
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web
Communications 
POS 
Web 
Data API
Communications 
Data API 
POS 
Web 
SQL
Communications 
Security User Stories 
----SQL Injection---- 
• Detect SQL-injection 
• Prevent SQL-injection 
• Respond to SQL-injection 
Data API 
POS 
Web 
SQL
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
SQL-Injection=> 
Log Detection 
Crypto 
Web
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
SQL-Injection 
Protection
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
SQL-Injection 
Protection 
SQL 
Protection
SQL-Injection 
Protection 
SQL-Injection 
Protection
SQL-Injection 
Security User Stories 
----SQL Injection---- 
• Detect SQL-injection 
• Prevent SQL-injection 
• Respond to SQL-injection 
Security Unity Test 
----SQL Injection---- 
• API -> SQL-injection 
• Processing Logic -> SQL-injection 
• BackEnd -> SQL-injection 
• Detect Injection
SQL-Injection 
Security User Stories 
Occurred 
----SQL Injection Occurred---- 
• Evaluate SQL-injection 
• If Critical Respond 
• If non-Critical Notify/Fix 
Security Unity Test 
----SQL Injection Detection--- 
• API -> Notify 
• Processing Logic -> Notify 
• BackEnd -> Notify 
• LockDown Each Layer
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
SQL-Injection
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web
Security Response
Communications 
Data API 
POS 
Web 
SQL
Communications 
SOAP 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
- 
REST 
Web
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
SQL 
Protection 
SQL 
SOAP 
- 
REST
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web
Communications 
Data API 
POS 
Web 
SQL 
Log
Communications 
Data API 
POS 
Web 
SOPE/REST
Communications 
Data API 
POS 
Web 
SOPE/REST
Communications 
POS 
Web 
SOPE/REST 
Why? 
Not encrypt?
Communications 
Web 
SOPE/REST 
Why? 
Not encrypt?
Communications 
Publicly Exposed 
Web 
Do Not Trust 
SOPE/REST
Design Pattern 
Exposed System 
BURN THEM!!!!
Communications 
I/O POS 
Web 
SOPE/REST
Communications 
I/O POS 
Web 
Detect 
and Burn 
SOPE/REST 
Detect 
and Burn
Communications 
I/O POS 
Web 
Service
Quick Tangent 
Better Web Server Layout
Communications 
Web Service 
SOPE/REST 
Encrypted 
SOPE/REST 
Encrypted 
Web Service
Communications 
Web Service 
SOPE/REST 
Encrypted 
Auth 
Auth 
Web Service 
SOPE/REST 
Encrypted
Segmentation Is Good
Communications 
POS 
API/DAL 
Crypto Honey-Pot 
Log Detection 
Crypto 
Web
Communications 
POS 
Web
Communications 
POS 
Web Bridge
Communications 
POS 
Web Bridge
Communications 
POS 
Web 
Bridge 
Detection is Easy 
Locking it down is Easy 
Everything is Hard 
Detection is Easy
If Breach Occurs 
POS 
Rotate Security 
Web 
Lock it All Down 
Respond Aggressively 
Burn it all Down 
Bridge 
Replace Server 
Fix Exploit
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web
For a Secure Segmentation - 
Developers Need To Design And Control 
• FireWalls 
• Network Layout 
• System Provisioning 
• System Security 
• ………
Communications 
API/DAL 
Honey-Pot 
Log Detection 
POS 
Web 
Port:1234 
Incoming TCP/UDP 
From: 10.88.10.1 
To: 10.88.11.255 
Port:7676 
Incoming TCP/UDP 
From: 10.88.88.1 
To: 10.88.99.111
Layered Defense 
Security Test
For Developer 
Security User Stories 
----Core DataBase is Hacked----
For Security 
Security User Stories 
----Core DataBase is Hacked----
For SysAdmin 
Security User Stories 
----Core DataBase is Hacked----
For CxO 
Security User Stories 
----Core DataBase is Hacked----
For ……….. 
Security User Stories 
----Core DataBase is Hacked----
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
Log
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
Log
Security User Stories 
----Core DataBase is Hacked---- 
• Prevent Changing the Logs 
• Prevent Access to Other DBs
Systems Game Theory
Systems Game Theory 
Anti-Fragile
Security User Stories 
----Lost DataBase Bridge---- 
• Keep WebServer Up 
• Take Services Down 
• Sync After Bridge is Up
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
Log
Security User Stories 
----Lost DataBase Bridge---- 
• Keep WebServer Up 
• Take Services Down 
• Sync After Bridge is Up
Developer Response 
System
• Security User Stories 
• Security Unit Test 
• Security Response Stories
Communications 
POS API/DAL 
Crypto 
Honey-Pot 
Log Detection 
Crypto 
Web 
Log
Security Response Stories 
----Hacker on Core Bridge---- 
• Guns 
• Fire 
• Pain
Security Response Stories 
----Hacker on Core Bridge---- 
• Activate Full Security Response 
• Revoke All Security Tokens 
• Lock Down All Choke Points
Developer Response 
System
Security User Stories 
----Lost POS Ingress--- 
• Revoke Old POS Privileges 
• Standup New POS System 
• Standup New POS Auth System
Communications 
Data API 
POS 
Auth 
Auth 
Auth
Communications 
Data API 
POS 
Auth 
Auth 
Auth
Network Diagram
If Extra Time 
Fun Attack Demo 
GrayWolf 
Demo 
Context
172 
FIN
173 
MORE INFORMATION @: 
www.DigitalBodyGuard.com 
JonM@DigitalBodyGuard.com 
Jon McCoy

Jon McCoy - AppSec-USA-2014 Hacking C#(.NET) Applications:Defend by Design

Editor's Notes

  • #4 First off, As Security by definition happens behind closed doors, AppSec/OWAS{P gives us the chance to talk openly about this, sharing in the win and burdens of what we are going up against. To me this out of band communication is a large part of what makes OWASP a critical part of the security world.
  • #6 I am here to condense my years of work in defending corporate players. I am going to take on a very specific roll of application defender, of company defender, of This is what I think Works for Me