SlideShare a Scribd company logo
Hack & Fix 

Hands on ColdFusion Security Training
Pete Freitag, Foundeo Inc.
David Epler, AboutWeb LLC
About Pete
• 17+Years ColdFusion Experience
• Job: Foundeo Inc. Consulting & Products
• CFSummit Gold Sponsor
• HackMyCF / FuseGuard
• blog: petefreitag.com
• twitter: @pfreitag
foundeo
• 15+ years ColdFusion experience
• Job: AboutWeb - Security Architect
• Several Security Certs: GWAPT, CEH
• Learn CF in a Week - Security
• OWASP Zed Attack Proxy (ZAP)
Evangelist
• blog: dcepler.net
• twitter: @dcepler
About David
Agenda
• About theVM
• File UploadVulnerabilities
• SQL Injection
• Path Traversals
• Cross Site Scripting
• OWASP ZAP
• Sneak Peak - ColdFusion Raijin/Blizzard
About theVM
• Ubuntu Linux (don’t worry)
• ColdFusion 11
• MySQL
• Username / password: cf / cf
• CF Admin Username / password: admin / cf
VM Setup
• Open Terminal
• cd /var/www/hackabletype
• git config —global user.email “cfsummit”
• git pull
• sudo a2dismod autoindex
• sudo service apache2 restart
Guiding Principals
• Defense In Depth
• Principal of Least Privilege
• Avoid Security by Obscurity
• Validation can save your bacon
• Even the best developers write insecure
code.
Hackable Type
http://hackabletype.local/
File Uploads
HackableType:Try to upload and execute a CFM file.
photo (cc) flickr user armchairbuilder 2012
File Uploads Rule #1
Never trust a MIME type
Never trust a MIME
• CF9 and below use the MIME type passed
by the browser / client.
• Attacker can send any MIME type.
• CF10+ can perform server side file
inspection (when strict=true, default).
• We can still get around this.
File Uploads Rule #2
AlwaysValidate The File Extension
Always validate file
extension
• CF10 allows you to specify a file extension
list in the accept attribute.
• You can also validate cffile.ServerFileExt
• Do both.
File Uploads Rule #3
Never upload directly to webroot
POST /upload.cfm
GET /photos/photo.cfm
Server
Hacker
Hacker uses a load tool to make repeated
concurrent requests.
The attacker will be able to 

execute photo.cfm before it is deleted.
Don't upload to web
root
• File can be executed before it's validated.
• Upload outside root, eg GetTempDirectory
ram://, s3, etc.
• Upload directly to S3: http://
www.petefreitag.com/item/833.cfm
Additional Tips
• Ensure upload directory can only serve
static files. Sandbox / file extension
whitelist on web server.
• Consider keeping files outside webroot and
serve with cfcontent or mod_xsendfile
• Specify mode on unix (eg 640 rw-r——)
• secureupload.cfc: https://github.com/
foundeo/cfml-security
SQL Injection
TweetPic from
someone that did
not responsibly
disclose issue to
site owner that has
SQL Injection
SQL Injection
<cfquery name="news">
SELECT id, title, story
FROM news
WHERE id = #url.id#
</cfquery>
news.cfm?id=1;delete+from+news
SQL Injection
• The solution - use parameters (eg
cfqueryparam) whenever possible.
• Validate and sanitize when you can't
• ORDER BY column
• SELECT TOP 10
• ORM: make sure HQL statements are
parameterized
SQL Injection
Try the lesson
Path Traversal
Vulnerabilities
Path Traversal Risk
• Attacker can read any file CF has
permission to read
• Configuration files
• System Files
• Logs
• Remote code execution possible in some
cases.
HackableType
Try the path traversal lesson
Preventing Path
Traversals
• Avoid file paths derived from user input.
• Strip and validate any variables used in
paths. Dots and slashes are dangerous.
• Beware of null bytes
• On windows use multiple drive letters to
separate application from OS, CF, logs, etc.
Path Traversal Bonus
Round
Can you use the path traversal lesson to perform
remote code execution?
Path Traversal
• Possible Remote Code Execution via
cfinclude
• CF11+ added Application.cfc and
ColdFusion administrator setting:
this.compileExtForInclude="cfm";
Cross Site Scripting

(XSS)
Hack & Fix, Hands on ColdFusion Security Training
XSS
• XSS holes give attackers a CMS to create
any content.
• Can be used to steal sessions
• Phish for passwords or other info.
XSS Types
• Reflected
• Persistant
• DOM
Reflected XSS
<cfoutput>
Hello #url.name#
</cfoutput>
hello.cfm?name=<script>...</script>
Reflected XSS
Try the lesson
Preventing XSS
• Strip out dangerous characters
• < > ' " ( ) ; #
• Escape dangerous characters
• CF10+ EncodeForHTML, etc.
Preventing XSS
Context Method
HTML encodeForHTML(variable)
HTML Attribute encodeForHTMLAttribute(variable)
JavaScript encodeForJavaScript(variable)
CSS encodeForCSS(variable)
URL encodeForURL(variable)
XSS in HTML
• Preventing XSS when allowing users to
enter HTML is difficult.
• AntiSamy -> isSafeHTML getSafeHTML
• ScrubHTML
XSS Utils
• Encoders
• ESAPI: http://
www.petefreitag.com/
item/788.cfm
• OWASP Encoder:
http://owasp-java-
encoder.googlecode.c
om

• Sanitizers
• AntiSamy: http://
www.petefreitag.com/
item/760.cfm
• ScrubHTML: https://
github.com/foundeo/
cfml-security
OWASP ZAP
• An easy to use web application penetration
testing tool
• Completely free and Open Source
• OWASP flagship project
• Included in major security distributions
• Kali, Samurai WTF, etc.
Why use ZAP?
• Ideal for beginners, developers
• also used by professional pen testers
• Point and shoot via Quick Start Tab
• Manual penetration testing
• As a debugger
• As part of larger security program
• Automated security regression tests
Main ZAP Features
• Intercepting Proxy
• Active and Passive Scanners
• Traditional and AJAX spiders
• Forced browsing
• Fuzzing
• Cross Platform
• built on Java (requires 1.7+)
Website
Intercepting Proxy
Using ZAP
Hands on
Content-Security-Policy
• HTTP Response Header dictates what
assets can be loaded. For example:
• script-src 'self';
• script-src 'self' cdn.example.com;
• script-src 'none';
• script-src 'unsafe-inline';
CSP Directives
• default-src
• script-src
• style-src
• img-src
• connect-src
• font-src
• object-src
• media-src
• frame-src
• sandbox
• report-uri
CSP 1.0 Browser Support
http://caniuse.com/#feat=contentsecuritypolicy
CSP 1.0 Browser
Support
• Chrome 25+
• FireFox 23+
• Safari 7+
• IE Edge 12+
• Partial Support in IE10+ (sandbox)
CSP Level 2
• Notable Enhancements
• Nonce
• Hash
• form-action directive
CSP Lesson
• Hint: content-security-policy.com
Want More?
• Scope Injection Lesson
• CSRF Lesson
ColdFusion 

Raijin/Blizzard

Security Analyzer
Questions?
ThankYou!
Pete Freitag
pete@foundeo.com
foundeo.com
David Epler
depler@aboutweb.com
dcepler.net

More Related Content

PDF
Exploiting Deserialization Vulnerabilities in Java
PDF
CKA Certified Kubernetes Administrator Notes
PDF
Mastering Real-time Linux
PPTX
CI/CD trên Cloud OpenStack tại Viettel Networks | Hà Minh Công, Phạm Tường Chiến
PDF
Ansible
PDF
Xen Project Contributor Training Part 3 - Communication v1.0
PPTX
DevOps at FSOFT as BOI | Nguyễn Hoài Nam, Vũ Xuân Lộc
PPTX
Secure container: Kata container and gVisor
Exploiting Deserialization Vulnerabilities in Java
CKA Certified Kubernetes Administrator Notes
Mastering Real-time Linux
CI/CD trên Cloud OpenStack tại Viettel Networks | Hà Minh Công, Phạm Tường Chiến
Ansible
Xen Project Contributor Training Part 3 - Communication v1.0
DevOps at FSOFT as BOI | Nguyễn Hoài Nam, Vũ Xuân Lộc
Secure container: Kata container and gVisor

What's hot (20)

DOCX
Bitbucket
PDF
Git flow Introduction
PDF
ColdFusion for Penetration Testers
PDF
Git 101: Git and GitHub for Beginners
PDF
Container Security
PPTX
Understanding iptables
PPTX
NGINX Installation and Tuning
PDF
Container Security Deep Dive & Kubernetes
PPT
Learning AOSP - Android Booting Process
PDF
Aprendendo Git
PDF
Linux Preempt-RT Internals
PPTX
Distributed Caching in Kubernetes with Hazelcast
PDF
Repository Management with JFrog Artifactory
PPTX
Load Balancing and Scaling with NGINX
PPTX
A successful Git branching model
PDF
Open vSwitch 패킷 처리 구조
PPTX
Jenkins tutorial
PDF
Formation autour de git et git lab
PDF
SSRF workshop
PDF
Introduction to Android Window System
Bitbucket
Git flow Introduction
ColdFusion for Penetration Testers
Git 101: Git and GitHub for Beginners
Container Security
Understanding iptables
NGINX Installation and Tuning
Container Security Deep Dive & Kubernetes
Learning AOSP - Android Booting Process
Aprendendo Git
Linux Preempt-RT Internals
Distributed Caching in Kubernetes with Hazelcast
Repository Management with JFrog Artifactory
Load Balancing and Scaling with NGINX
A successful Git branching model
Open vSwitch 패킷 처리 구조
Jenkins tutorial
Formation autour de git et git lab
SSRF workshop
Introduction to Android Window System

Viewers also liked (8)

PDF
Hack Harvard 2012: Open Source is Big Business
PPT
Hacker
PDF
CARA BOBOL ROUTER WIFI ID
PPT
Course on Ehtical Hacking - Introduction
PDF
Full Buku sakti belajar hacker
PDF
10 Langkah Awal Menjadi Seorang Ahli Komputer
PPTX
Hacking ppt
PPTX
Hacking & its types
Hack Harvard 2012: Open Source is Big Business
Hacker
CARA BOBOL ROUTER WIFI ID
Course on Ehtical Hacking - Introduction
Full Buku sakti belajar hacker
10 Langkah Awal Menjadi Seorang Ahli Komputer
Hacking ppt
Hacking & its types

Similar to Hack & Fix, Hands on ColdFusion Security Training (20)

PDF
Securing Legacy CFML Code
PDF
Securing applications
PDF
Lares from LOW to PWNED
PPTX
Securing your web applications in CF 2016
PDF
Locking Down CF Servers
PPT
Bsides-Philly-2016-Finding-A-Companys-BreakPoint
PDF
Locking Down CF Servers
PDF
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ODP
Wordpress Security 101
PDF
Cold fusion Security-How to Secure Coldfusion Server
PDF
Ch 10: Attacking Back-End Components
PDF
Ch 13: Attacking Other Users: Other Techniques (Part 1)
PPT
"Running CF in a Shared Hosting Environment"
PDF
Cache Rules Everything Around Me
PDF
CNIT 129S: 10: Attacking Back-End Components
PDF
NotaCon 2011 - Networking for Pentesters
PDF
SOHOpelessly Broken
PPT
Dc10 beale-attackdefendunix
PPTX
Web Application Security - Folio3
PPSX
WordPress Security by Nirjhor Anjum
Securing Legacy CFML Code
Securing applications
Lares from LOW to PWNED
Securing your web applications in CF 2016
Locking Down CF Servers
Bsides-Philly-2016-Finding-A-Companys-BreakPoint
Locking Down CF Servers
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
Wordpress Security 101
Cold fusion Security-How to Secure Coldfusion Server
Ch 10: Attacking Back-End Components
Ch 13: Attacking Other Users: Other Techniques (Part 1)
"Running CF in a Shared Hosting Environment"
Cache Rules Everything Around Me
CNIT 129S: 10: Attacking Back-End Components
NotaCon 2011 - Networking for Pentesters
SOHOpelessly Broken
Dc10 beale-attackdefendunix
Web Application Security - Folio3
WordPress Security by Nirjhor Anjum

More from ColdFusionConference (20)

PDF
Api manager preconference
PDF
PDF
Building better SQL Server Databases
PDF
API Economy, Realizing the Business Value of APIs
PDF
Don't just pdf, Smart PDF
PDF
Crafting ColdFusion Applications like an Architect
PDF
Security And Access Control For APIS using CF API Manager
PDF
Monetizing Business Models: ColdFusion and APIS
PDF
Become a Security Rockstar with ColdFusion 2016
PDF
ColdFusion in Transit action
PDF
Developer Insights for Application Upgrade to ColdFusion 2016
PDF
Where is cold fusion headed
PDF
ColdFusion Keynote: Building the Agile Web Since 1995
PDF
Instant ColdFusion with Vagrant
PPT
Restful services with ColdFusion
PDF
Super Fast Application development with Mura CMS
PDF
Build your own secure and real-time dashboard for mobile and web
PDF
Why Everyone else writes bad code
PDF
Testing automaton
PDF
Rest ful tools for lazy experts
Api manager preconference
Building better SQL Server Databases
API Economy, Realizing the Business Value of APIs
Don't just pdf, Smart PDF
Crafting ColdFusion Applications like an Architect
Security And Access Control For APIS using CF API Manager
Monetizing Business Models: ColdFusion and APIS
Become a Security Rockstar with ColdFusion 2016
ColdFusion in Transit action
Developer Insights for Application Upgrade to ColdFusion 2016
Where is cold fusion headed
ColdFusion Keynote: Building the Agile Web Since 1995
Instant ColdFusion with Vagrant
Restful services with ColdFusion
Super Fast Application development with Mura CMS
Build your own secure and real-time dashboard for mobile and web
Why Everyone else writes bad code
Testing automaton
Rest ful tools for lazy experts

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
A Presentation on Artificial Intelligence
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
Teaching material agriculture food technology
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
NewMind AI Monthly Chronicles - July 2025
Encapsulation_ Review paper, used for researhc scholars
A Presentation on Artificial Intelligence
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Reach Out and Touch Someone: Haptics and Empathic Computing
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Teaching material agriculture food technology
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...

Hack & Fix, Hands on ColdFusion Security Training