SlideShare a Scribd company logo
1 of 34
Started In Security
Now I’m Here
Christopher Grayson (OSCE)
Tales from a hacker-turned-code-monkey
INTRODUCTION
3
WHOAMI
4
What Are We Talking About?
• A journey from security to software
• Going from software to security seems to be
more common
• No formal development training, so lots of
“learning opportunities”
5
Why Are We Talking About It?
• Differences in perspective yield valuable
lessons
• The security field has a problem w/ only
chatting amongst themselves
• I want my headaches to prevent similar
headaches for my colleagues
6
Agenda
1. My Background
2. Core Security Concepts
3. Lessons Learned
4. Security Regression
5. Conclusion
A BIT OF BACKGROUND
8
It All Started With Mega Man X
• Parents in IT and psychology, raised a white-hat
hacker
• Mega Man X was my first teacher
• Starcraft map editor was my first exposure to
coding
• I thought I wanted to be a video game
developer
9
“Professional” Life And Beyond
• Brief stint in development at a marketing
company
• Landed a job as a research scientist on a DARPA
contract
• Got into security through a student org
• Broke into all the things, noticed a sorely
missing capability, left to build it
10
Web Sight High-level Architecture
• Massive, scalable data gathering platform
• Back-end written in Python, front-end in
Angular 2 (yay Typescript)
• Uses Redis, PostgreSQL, RabbitMQ, Celery,
Elasticsearch, Django Rest Framework
• Deployed in EC2, has been deployed on DO
• Used to use Docker
SECURITY CONCEPTS
12
Definitions Of Hacking
Give me a set of rules, and I’ll follow those rules and
accomplish something they weren’t meant to allow.
Finding the difference between what something was made to
do and what something can do.
- lavalamp
- xray
13
Principle Of Least Privilege
…in a particular abstraction layer of a computing
environment, every module must be able to access only the
information and resources that are necessary for its
legitimate purpose.
- Wikipedia
• Obvious
• Deceptively difficult
• Halting problem!
• Common causes for violation:
• Scope creep
• Unknown framework functionality
• Definition of hacking
14
OWASP Top 10
• Open Web Application Security Project
• Maintains a list of most common web
vulnerabilities by year
• Rarely changes year-to-year
• Common vulns we may touch on:
• Cross-site Scripting (XSS)
• Cross-site Request Forgery (CSRF)
• SQL Injection (SQLI)
<div></div><script>Alert(’Hi’);</script>
15
The Problem Of Injection / Data Confusion
• Many vulnerabilities can be tied to software confusing data for control
characters or packaging
• SQL Injection • Template Injection • Cross-site Scripting
userId = 1;
Expected
userId = 1 or 1=1;
Actual
$sql = “select * from users where userId =
“ . $_GET[“userId”] + “;”;
$result = mysql_query($sql);
Code
select * from users where userId = 1 or
1=1;
Result
user_name = “chris”
Expected
user_name = “{{ 2 + 2 }}”
Actual
template = “Hello there %s” % user_name
r_template = Template(template)
Code
Hello there {{ 2 + 2 }}
Result
user_name = “chris”
Expected
User_name =
“</div><script>Alert(‘Hi’);</script>”
Actual
<div> Hello {{user_name}} </div>
Code
Result
16
Fail Open vs. Fail Closed
• ”Fail closed” refers to a situation in which,
when an error occurs, execution is halted.
• ”Fail open” would instead allow processing to
continue.
• Security professionals love fail closed
• Software developers tend to prefer fail open
17
Complexity vs. Security
• At a theoretical level, complexity and security
have a strong inverse relationship
• Put simply, the more complex something is the
more difficult it is to secure
• Keep It Simple Stupid (KISS) has implications
for both ease of code maintenance and code
security
0
1
2
3
4
5
6
1 2 3 4 5
Complexity Security
LESSONS LEARNED
19
Where Does Security Fit?
• Initial architectural discussions
• QA step for sprints/releases/etc.
• Black/grey/white-box testing for software post-
deployment
• Developers should give security veto power
• Security professionals must consider realistic
constraints
20
Security Costs Time
• When in a tight spot, security is commonly one
of the first considerations to fall by the way-
side
• Any improvements to development speed
(enhanced devops, continuous integration)
should be considered security enhancements
• The ultimate cost of security with respect to
development is time
21
Full-featured == Dangerous
• Know. Your. Frameworks. Inside and out.
• If going from nothing to a full-fledged web app
takes a minimal amount of code, a LOT of
things are happening out of sight
• Architects must know the ins and outs of any
core frameworks they use
22
Full-featured == Dangerous (Django)
from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from tutorial.quickstart.serializers import UserSerializer,
GroupSerializerclass
UserViewSet(viewsets.ModelViewSet):
""”
API endpoint that allows users to be viewed or edited.
""”
queryset = User.objects.all().order_by('-date_joined')
serializer_class = UserSerializerclass
GroupViewSet(viewsets.ModelViewSet):
""”
API endpoint that allows groups to be viewed or edited.
""”
queryset = Group.objects.all()
serializer_class = GroupSerializer
• Does this look familiar?
• Is this what you want?
• Full CRUD access to User instances
• Is there a field on User that
application users should not be
able to modify?
• Indirect Object Reference
class WelcomeController < ApplicationController
def index
render params[:id]
end
end
23
Full-featured == Dangerous (Ruby on Rails)
• RoR documented best practice
• Vulnerable to remote code
execution (CVE-2016-2098)
• Pass dictionary as parameter,
dictionary unpacked as keyword
arguments to render method,
supply template keyword
argument, code execution!
24
Single-page Apps == 
• Single page apps (SPAs) immediately protect
against severe vulnerabilities out of the box
• Cross-site request forgery
• Cross-site scripting
• Great separation of responsibilities
• Greatly reduced complexity of back-end
• Vulns in front-end only affect individual users
instead of entire user-base
25
Quick n’ Easy Security Gains
• Security Response Headers
• HTTP Strict Transport Security
• Content Security Policy
• Frame Options
• Content Sniffing
• Cross-site Scripting Protection
• Cookie Flags
• HTTP Only
• Secure
• SSL
• No excuse for no encryption
• Regular Expressions
• Strongest form of input validation
• HTML Entity Encoding
• De-fang all user input from injection
capabilities
• Object-relational Mapping (ORM)
• Let a framework handle database
interaction, avoid injection
26
Quick n’ Dirty Security Gotchas
• Improper Input Validation
• Blacklists are weak – always prefer
whitelists, regexes where possible
• Attackers rely on being able to submit
unexpected data
• User-generated Templates
• Back to the confusion between data
and control
• Authentication Back-end
• LDAP-based auth should not be publicly
exposed
• Automation
• Sensitive operations should only be
invoked manually
• Insufficient Randomness
• Sensitive random values (ie: activation
tokens, forgot password tokens, etc.)
must be securely random
• User Enumeration
• Feels innocuous, but a list of valid users
goes a long way for attackers
SECURITY REGRESSION
28
The Problem Of Regression
• Regression testing for codebases is a large
problem with a standardized solution
• Regression with respect to security is an even
larger problem
• Just because a vuln is fixed once does not
mean it remains fixed
29
Unit Testing To Address Regression
• Take the approach used to fix regression issues
in codebases and use it to address security
regression as well
• Integrate into deployment process to ensure
that security holes remain fixed for every
deployment
• Security teams can write unit tests, hand off to
developers, use TDD to improve security
30
Security Regression Testing
• Proper Input Validation
• Presence of Expected Security Headers
• Anti-automation
• Proper Access Control Enforcement
I am currently working on a base framework to provide this
functionality, to be released at QCon NYC (late June 2017)
CONCLUSION
32
Takeaways
• Security should be integrated into development efforts from square one
• Security is hard, and expecting developers to know how to do it properly
is a recipe for disaster
• There are many ”easy wins” for securing web apps, many of which have
been enumerated here
• The scope of unit testing can (and should) be expanded to include security
checks as a standardized practice
33
Additional Resources
• OWASP
• https://www.owasp.org/index.php/Main_Page
• So You Want To Be A Hacker?
• https://www.slideshare.net/ChrisGrayson/so-you-want-to-be-a-hacker
• Web Sight
• https://websight.io
• OWASP Secure SDLC Cheat Sheet
• https://www.owasp.org/index.php/Secure_SDLC_Cheat_Sheet
THANK YOU!
CHRIS@WEBSIGHT.IO
@_LAVALAMP

More Related Content

What's hot

Attack All the Layers - What's Working in Penetration Testing
Attack All the Layers - What's Working in Penetration TestingAttack All the Layers - What's Working in Penetration Testing
Attack All the Layers - What's Working in Penetration Testing
NetSPI
 
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
CODE BLUE
 

What's hot (20)

Kali Linux - Falconer - ISS 2014
Kali Linux - Falconer - ISS 2014Kali Linux - Falconer - ISS 2014
Kali Linux - Falconer - ISS 2014
 
Introduction to red team operations
Introduction to red team operationsIntroduction to red team operations
Introduction to red team operations
 
How to Build Your Own Physical Pentesting Go-bag
How to Build Your Own Physical Pentesting Go-bagHow to Build Your Own Physical Pentesting Go-bag
How to Build Your Own Physical Pentesting Go-bag
 
Pentest Apocalypse
Pentest ApocalypsePentest Apocalypse
Pentest Apocalypse
 
Visiting the Bear Den
Visiting the Bear DenVisiting the Bear Den
Visiting the Bear Den
 
Kali linux tutorial
Kali linux tutorialKali linux tutorial
Kali linux tutorial
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShell
 
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malwareDefcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
 
Top Security Challenges Facing Credit Unions Today
Top Security Challenges Facing Credit Unions TodayTop Security Challenges Facing Credit Unions Today
Top Security Challenges Facing Credit Unions Today
 
All You Need is One - A ClickOnce Love Story - Secure360 2015
All You Need is One -  A ClickOnce Love Story - Secure360 2015All You Need is One -  A ClickOnce Love Story - Secure360 2015
All You Need is One - A ClickOnce Love Story - Secure360 2015
 
Defcon 22-zoltan-balazs-bypass-firewalls-application-whiteli
Defcon 22-zoltan-balazs-bypass-firewalls-application-whiteliDefcon 22-zoltan-balazs-bypass-firewalls-application-whiteli
Defcon 22-zoltan-balazs-bypass-firewalls-application-whiteli
 
Attack All the Layers - What's Working in Penetration Testing
Attack All the Layers - What's Working in Penetration TestingAttack All the Layers - What's Working in Penetration Testing
Attack All the Layers - What's Working in Penetration Testing
 
BASIC OVERVIEW OF KALI LINUX
BASIC OVERVIEW OF KALI LINUXBASIC OVERVIEW OF KALI LINUX
BASIC OVERVIEW OF KALI LINUX
 
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
 
A Google Event You Won't Forget
A Google Event You Won't ForgetA Google Event You Won't Forget
A Google Event You Won't Forget
 
PKI in DevOps: How to Deploy Certificate Automation within CI/CD
PKI in DevOps: How to Deploy Certificate Automation within CI/CDPKI in DevOps: How to Deploy Certificate Automation within CI/CD
PKI in DevOps: How to Deploy Certificate Automation within CI/CD
 
Kali Linux Installation - VMware
Kali Linux Installation - VMwareKali Linux Installation - VMware
Kali Linux Installation - VMware
 
BSides Denver 2019 - Cloud Wars Episode V: The Cryptojacker Strikes Back
BSides Denver 2019 - Cloud Wars Episode V: The Cryptojacker Strikes BackBSides Denver 2019 - Cloud Wars Episode V: The Cryptojacker Strikes Back
BSides Denver 2019 - Cloud Wars Episode V: The Cryptojacker Strikes Back
 
Docker & Daily DevOps
Docker & Daily DevOpsDocker & Daily DevOps
Docker & Daily DevOps
 
Linux/Unix Night - (PEN) Testing Toolkits (English)
Linux/Unix Night - (PEN) Testing Toolkits (English)Linux/Unix Night - (PEN) Testing Toolkits (English)
Linux/Unix Night - (PEN) Testing Toolkits (English)
 

Viewers also liked

Viewers also liked (8)

Grey H@t - DNS Cache Poisoning
Grey H@t - DNS Cache PoisoningGrey H@t - DNS Cache Poisoning
Grey H@t - DNS Cache Poisoning
 
Grey H@t - Academic Year 2012-2013 Recap
Grey H@t - Academic Year 2012-2013 RecapGrey H@t - Academic Year 2012-2013 Recap
Grey H@t - Academic Year 2012-2013 Recap
 
Root the Box - An Open Source Platform for CTF Administration
Root the Box - An Open Source Platform for CTF AdministrationRoot the Box - An Open Source Platform for CTF Administration
Root the Box - An Open Source Platform for CTF Administration
 
Cloudstone - Sharpening Your Weapons Through Big Data
Cloudstone - Sharpening Your Weapons Through Big DataCloudstone - Sharpening Your Weapons Through Big Data
Cloudstone - Sharpening Your Weapons Through Big Data
 
You, and Me, and Docker Makes Three
You, and Me, and Docker Makes ThreeYou, and Me, and Docker Makes Three
You, and Me, and Docker Makes Three
 
CableTap - Wirelessly Tapping Your Home Network
CableTap - Wirelessly Tapping Your Home NetworkCableTap - Wirelessly Tapping Your Home Network
CableTap - Wirelessly Tapping Your Home Network
 
Grey H@t - Cross-site Request Forgery
Grey H@t - Cross-site Request ForgeryGrey H@t - Cross-site Request Forgery
Grey H@t - Cross-site Request Forgery
 
So You Want to be a Hacker?
So You Want to be a Hacker?So You Want to be a Hacker?
So You Want to be a Hacker?
 

Similar to Started In Security Now I'm Here

Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja WarriorsRyan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
Ryan Elkins
 
Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...
Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...
Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...
Denim Group
 
Supply Chain Security for Developers.pdf
Supply Chain Security for Developers.pdfSupply Chain Security for Developers.pdf
Supply Chain Security for Developers.pdf
ssuserc5b30e
 
Succeeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps finalSucceeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps final
rkadayam
 

Similar to Started In Security Now I'm Here (20)

Programming languages and techniques for today’s embedded andIoT world
Programming languages and techniques for today’s embedded andIoT worldProgramming languages and techniques for today’s embedded andIoT world
Programming languages and techniques for today’s embedded andIoT world
 
Application security meetup k8_s security with zero trust_29072021
Application security meetup k8_s security with zero trust_29072021Application security meetup k8_s security with zero trust_29072021
Application security meetup k8_s security with zero trust_29072021
 
Cyber security - It starts with the embedded system
Cyber security - It starts with the embedded systemCyber security - It starts with the embedded system
Cyber security - It starts with the embedded system
 
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja WarriorsRyan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
 
chap-1 : Vulnerabilities in Information Systems
chap-1 : Vulnerabilities in Information Systemschap-1 : Vulnerabilities in Information Systems
chap-1 : Vulnerabilities in Information Systems
 
The New Security Practitioner
The New Security PractitionerThe New Security Practitioner
The New Security Practitioner
 
SCS DevSecOps Seminar - State of DevSecOps
SCS DevSecOps Seminar - State of DevSecOpsSCS DevSecOps Seminar - State of DevSecOps
SCS DevSecOps Seminar - State of DevSecOps
 
For Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecFor Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSec
 
VMWare Tech Talk: "The Road from Rugged DevOps to Security Chaos Engineering"
VMWare Tech Talk: "The Road from Rugged DevOps to Security Chaos Engineering"VMWare Tech Talk: "The Road from Rugged DevOps to Security Chaos Engineering"
VMWare Tech Talk: "The Road from Rugged DevOps to Security Chaos Engineering"
 
Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...
Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...
Threat Modeling the CI/CD Pipeline to Improve Software Supply Chain Security ...
 
TechTalk 2021: Peran IT Security dalam Penerapan DevOps
TechTalk 2021: Peran IT Security dalam Penerapan DevOpsTechTalk 2021: Peran IT Security dalam Penerapan DevOps
TechTalk 2021: Peran IT Security dalam Penerapan DevOps
 
Breaking Secure Mobile Applications - Hack In The Box 2014 KL
Breaking Secure Mobile Applications - Hack In The Box 2014 KLBreaking Secure Mobile Applications - Hack In The Box 2014 KL
Breaking Secure Mobile Applications - Hack In The Box 2014 KL
 
Enumerating software security design flaws throughout the ssdlc cosac - 201...
Enumerating software security design flaws throughout the ssdlc   cosac - 201...Enumerating software security design flaws throughout the ssdlc   cosac - 201...
Enumerating software security design flaws throughout the ssdlc cosac - 201...
 
Enumerating software security design flaws throughout the SSDLC
Enumerating software security design flaws throughout the SSDLCEnumerating software security design flaws throughout the SSDLC
Enumerating software security design flaws throughout the SSDLC
 
Building world-class security response and secure development processes
Building world-class security response and secure development processesBuilding world-class security response and secure development processes
Building world-class security response and secure development processes
 
Addressing Cloud Security with OPA
Addressing Cloud Security with OPAAddressing Cloud Security with OPA
Addressing Cloud Security with OPA
 
Null application security in an agile world
Null application security in an agile worldNull application security in an agile world
Null application security in an agile world
 
Slide Deck CISSP Class Session 5
Slide Deck CISSP Class Session 5Slide Deck CISSP Class Session 5
Slide Deck CISSP Class Session 5
 
Supply Chain Security for Developers.pdf
Supply Chain Security for Developers.pdfSupply Chain Security for Developers.pdf
Supply Chain Security for Developers.pdf
 
Succeeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps finalSucceeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps final
 

Recently uploaded

( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 

Recently uploaded (20)

Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 

Started In Security Now I'm Here

  • 1. Started In Security Now I’m Here Christopher Grayson (OSCE) Tales from a hacker-turned-code-monkey
  • 4. 4 What Are We Talking About? • A journey from security to software • Going from software to security seems to be more common • No formal development training, so lots of “learning opportunities”
  • 5. 5 Why Are We Talking About It? • Differences in perspective yield valuable lessons • The security field has a problem w/ only chatting amongst themselves • I want my headaches to prevent similar headaches for my colleagues
  • 6. 6 Agenda 1. My Background 2. Core Security Concepts 3. Lessons Learned 4. Security Regression 5. Conclusion
  • 7. A BIT OF BACKGROUND
  • 8. 8 It All Started With Mega Man X • Parents in IT and psychology, raised a white-hat hacker • Mega Man X was my first teacher • Starcraft map editor was my first exposure to coding • I thought I wanted to be a video game developer
  • 9. 9 “Professional” Life And Beyond • Brief stint in development at a marketing company • Landed a job as a research scientist on a DARPA contract • Got into security through a student org • Broke into all the things, noticed a sorely missing capability, left to build it
  • 10. 10 Web Sight High-level Architecture • Massive, scalable data gathering platform • Back-end written in Python, front-end in Angular 2 (yay Typescript) • Uses Redis, PostgreSQL, RabbitMQ, Celery, Elasticsearch, Django Rest Framework • Deployed in EC2, has been deployed on DO • Used to use Docker
  • 12. 12 Definitions Of Hacking Give me a set of rules, and I’ll follow those rules and accomplish something they weren’t meant to allow. Finding the difference between what something was made to do and what something can do. - lavalamp - xray
  • 13. 13 Principle Of Least Privilege …in a particular abstraction layer of a computing environment, every module must be able to access only the information and resources that are necessary for its legitimate purpose. - Wikipedia • Obvious • Deceptively difficult • Halting problem! • Common causes for violation: • Scope creep • Unknown framework functionality • Definition of hacking
  • 14. 14 OWASP Top 10 • Open Web Application Security Project • Maintains a list of most common web vulnerabilities by year • Rarely changes year-to-year • Common vulns we may touch on: • Cross-site Scripting (XSS) • Cross-site Request Forgery (CSRF) • SQL Injection (SQLI)
  • 15. <div></div><script>Alert(’Hi’);</script> 15 The Problem Of Injection / Data Confusion • Many vulnerabilities can be tied to software confusing data for control characters or packaging • SQL Injection • Template Injection • Cross-site Scripting userId = 1; Expected userId = 1 or 1=1; Actual $sql = “select * from users where userId = “ . $_GET[“userId”] + “;”; $result = mysql_query($sql); Code select * from users where userId = 1 or 1=1; Result user_name = “chris” Expected user_name = “{{ 2 + 2 }}” Actual template = “Hello there %s” % user_name r_template = Template(template) Code Hello there {{ 2 + 2 }} Result user_name = “chris” Expected User_name = “</div><script>Alert(‘Hi’);</script>” Actual <div> Hello {{user_name}} </div> Code Result
  • 16. 16 Fail Open vs. Fail Closed • ”Fail closed” refers to a situation in which, when an error occurs, execution is halted. • ”Fail open” would instead allow processing to continue. • Security professionals love fail closed • Software developers tend to prefer fail open
  • 17. 17 Complexity vs. Security • At a theoretical level, complexity and security have a strong inverse relationship • Put simply, the more complex something is the more difficult it is to secure • Keep It Simple Stupid (KISS) has implications for both ease of code maintenance and code security 0 1 2 3 4 5 6 1 2 3 4 5 Complexity Security
  • 19. 19 Where Does Security Fit? • Initial architectural discussions • QA step for sprints/releases/etc. • Black/grey/white-box testing for software post- deployment • Developers should give security veto power • Security professionals must consider realistic constraints
  • 20. 20 Security Costs Time • When in a tight spot, security is commonly one of the first considerations to fall by the way- side • Any improvements to development speed (enhanced devops, continuous integration) should be considered security enhancements • The ultimate cost of security with respect to development is time
  • 21. 21 Full-featured == Dangerous • Know. Your. Frameworks. Inside and out. • If going from nothing to a full-fledged web app takes a minimal amount of code, a LOT of things are happening out of sight • Architects must know the ins and outs of any core frameworks they use
  • 22. 22 Full-featured == Dangerous (Django) from django.contrib.auth.models import User, Group from rest_framework import viewsets from tutorial.quickstart.serializers import UserSerializer, GroupSerializerclass UserViewSet(viewsets.ModelViewSet): ""” API endpoint that allows users to be viewed or edited. ""” queryset = User.objects.all().order_by('-date_joined') serializer_class = UserSerializerclass GroupViewSet(viewsets.ModelViewSet): ""” API endpoint that allows groups to be viewed or edited. ""” queryset = Group.objects.all() serializer_class = GroupSerializer • Does this look familiar? • Is this what you want? • Full CRUD access to User instances • Is there a field on User that application users should not be able to modify? • Indirect Object Reference
  • 23. class WelcomeController < ApplicationController def index render params[:id] end end 23 Full-featured == Dangerous (Ruby on Rails) • RoR documented best practice • Vulnerable to remote code execution (CVE-2016-2098) • Pass dictionary as parameter, dictionary unpacked as keyword arguments to render method, supply template keyword argument, code execution!
  • 24. 24 Single-page Apps ==  • Single page apps (SPAs) immediately protect against severe vulnerabilities out of the box • Cross-site request forgery • Cross-site scripting • Great separation of responsibilities • Greatly reduced complexity of back-end • Vulns in front-end only affect individual users instead of entire user-base
  • 25. 25 Quick n’ Easy Security Gains • Security Response Headers • HTTP Strict Transport Security • Content Security Policy • Frame Options • Content Sniffing • Cross-site Scripting Protection • Cookie Flags • HTTP Only • Secure • SSL • No excuse for no encryption • Regular Expressions • Strongest form of input validation • HTML Entity Encoding • De-fang all user input from injection capabilities • Object-relational Mapping (ORM) • Let a framework handle database interaction, avoid injection
  • 26. 26 Quick n’ Dirty Security Gotchas • Improper Input Validation • Blacklists are weak – always prefer whitelists, regexes where possible • Attackers rely on being able to submit unexpected data • User-generated Templates • Back to the confusion between data and control • Authentication Back-end • LDAP-based auth should not be publicly exposed • Automation • Sensitive operations should only be invoked manually • Insufficient Randomness • Sensitive random values (ie: activation tokens, forgot password tokens, etc.) must be securely random • User Enumeration • Feels innocuous, but a list of valid users goes a long way for attackers
  • 28. 28 The Problem Of Regression • Regression testing for codebases is a large problem with a standardized solution • Regression with respect to security is an even larger problem • Just because a vuln is fixed once does not mean it remains fixed
  • 29. 29 Unit Testing To Address Regression • Take the approach used to fix regression issues in codebases and use it to address security regression as well • Integrate into deployment process to ensure that security holes remain fixed for every deployment • Security teams can write unit tests, hand off to developers, use TDD to improve security
  • 30. 30 Security Regression Testing • Proper Input Validation • Presence of Expected Security Headers • Anti-automation • Proper Access Control Enforcement I am currently working on a base framework to provide this functionality, to be released at QCon NYC (late June 2017)
  • 32. 32 Takeaways • Security should be integrated into development efforts from square one • Security is hard, and expecting developers to know how to do it properly is a recipe for disaster • There are many ”easy wins” for securing web apps, many of which have been enumerated here • The scope of unit testing can (and should) be expanded to include security checks as a standardized practice
  • 33. 33 Additional Resources • OWASP • https://www.owasp.org/index.php/Main_Page • So You Want To Be A Hacker? • https://www.slideshare.net/ChrisGrayson/so-you-want-to-be-a-hacker • Web Sight • https://websight.io • OWASP Secure SDLC Cheat Sheet • https://www.owasp.org/index.php/Secure_SDLC_Cheat_Sheet