Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What I've Learned Writing CTF Challenges
Search
vito
February 11, 2017
Programming
0
140
What I've Learned Writing CTF Challenges
BSides Tampa, 2/11/2017
vito
February 11, 2017
Tweet
Share
More Decks by vito
See All by vito
Modernizing SQL Injection CTF Challenges
vito
0
88
Raw Water: Quenching Your Thirst for SQL Injection
vito
0
67
Lessons Learned from Five Years of Building Capture the Flag
vito
0
470
Capture the Flag: An Owner's Manual
vito
0
84
Building DEF CON CTF with Ruby
vito
0
580
Other Decks in Programming
See All in Programming
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
100
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
450
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
780
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
440
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
Haze - Real time background blurring
chrisbanes
1
510
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
4
590
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
200
情報漏洩させないための設計
kubotak
2
240
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
GraphQLとの向き合い方2022年版
quramy
44
13k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Optimising Largest Contentful Paint
csswizardry
33
3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Gamification - CAS2011
davidbonilla
80
5.1k
It's Worth the Effort
3n
183
28k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Transcript
What I’ve Learned Writing CTF Challenges Vito Genovese BSides Tampa
February 11, 2017
What is CTF?
What is CTF?
Jeopardy Style
Attack-Defense
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
CGC Jargon • Cyber Reasoning System • Proof of Vulnerability
• Replacement Binary • Challenge Binary
BSTies http://bsties.notmalware.ru
CTF Challenges Teams attack it
CTF Challenges Protects something of in-game value
CTF Challenges Ideally: known solvable
CTF Challenges Also ideally: appropriately tricky
None
None
Solving 'em • Correct side of an if statement •
Cracking a code • Using SQL injection to trick a database • Stealing the garbage file from the Gibson
Actually Building One
None
Original Goal
Original Goal
• Given same STDIN • Same STDOUT • Same clock
cycles • Same syscalls
https://xkcd.com/1319/
Why Automate?
None
Thousand Cuts
Thousand Cuts
Thousand Cuts
Actually Building It
Start the First One 1. Set up CGC service-template 2.
Test not-crashing 3. Make binary that doesn’t crash 4. Test crashing 5. Make binary that crashes
First One's Done • Ruby script to spit out 334
binaries • Vary buffer sizes • Vary stack cookie • Python script running game flow
First Set's Done Figure out how to make second and
third sets
Second Set Python script to add stuff to source code
Third Set Python script to rearrange source code
All Sets Done Test the difficulty
Integration Testing With Gyno • Finds a bug in like
30s • Fixing the bug took 30m • (fixing the bug a week prior would've taken 5m)
More Integration Testing kind of weird
easy-prasky • single binary • Baby’s First category • Separate
CRS work from first stab at CGCEF • Hacked to be first in 334 cuts
Deployment • Determine ops requirements • CGC kernel • Python
installed • Open port
Deployment Puppetize it!
Deployment
Running it just kinda worked (once teams Got It)
CTF Challenge Process 1.Idea 2.Build 3.Test
CTF Challenge Framework • Configuration • Build • Testing •
Deployment
CTF Challenge Framework CGC service-template
CTF Challenge Deployment put it on a server lol
It's Just Software
Software Goals Useful Usable Reliable
Useful for Competition Separate teams that solve it from teams
that don't Prefer strong correlation with finals ranking
Useful for Education Teach new players something Get players over
a hang-up
Usable Intended difficulty only Minimize corner cases Unintended vulnerabilities?
Reliable Remain vulnerable
Reliability is Hard Players like to attack Players like to
brute Players like to complain
Reliability is Hard
Reliability is Demanding
Reliability is Expensive If you want it to be
Reliability is Cheap Build software that can be run reliably
Twelve Factor App • VIII. Concurrency • Scale out via
the process model • IX. Disposability • Maximize robustness with fast startup and graceful shutdown
Twelve Factor Challenges • Limit global state • Process per
connection • xinetd ftw • Make adding resources cheap
Adding Resources Automate!
Operations Automation Puppet or Chef for server provisioning
Operations Automation Docker is slow to spin up RunC is
fast
Shared State • Process per connection not always feasible •
Sandwich challenges in 2014 • JRuby & Celluloid slow to start • State still per connection
Shared State • Global state and web challenges • Persisted
XSS • Tricking a global database
Waiting For Your Touch • 2015 web challenge • /r/thebutton
knockoff • JRuby, Rails, websockets, postgres
Waiting For Your Touch
Waiting For The Challenge Slow when not slow 500s Thankfully
during the day
Waiting For Your Touch 1. Took it down 2. Opened
replacement challenge 3. Debugged for an hour
Debugging For Your Touch 4. Leaked and exhausted postgres connections
5. Fixed leak 6. Allocated more connections
Waiting For My Fix 7. Took an hour 8. Gyno
forced a fifteen minute cool-down between "is it fixed" and "it is fixed" 9. Reopened
Most Important Part People are the most important
Respect People • Respect for yourself • Respect for your
team • Respect for players
Respect for Yourself
Respect for Your Team
Respect for Your Team
Respect for Your team Make services easy to keep running
Document!
Respect for Your Team Provide easy to run smoke tests
"Is this exploitable?" should be a one-liner that spits out the flag
Respect for Players
Respect for Players
Respect for Players
Respect for Players
Building Challenges is Software Development Useful Usable Reliable
Reliability Imposes Constraints Limit state Limit dependencies Automate
Respect Is Fundamental Self Team Players
Thanks! Vito Genovese
[email protected]
@vito_lbs GPG B07D616143CAA77B https://legitbs.net @legitbs_ctf