Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building DEF CON CTF with Ruby

vito
February 21, 2014

Building DEF CON CTF with Ruby

Presented at Big Ruby Conference, Grapevine, TX, Feb. 20 2014

vito

February 21, 2014
Tweet

More Decks by vito

Other Decks in Programming

Transcript

  1. What is DEF CON? “DEF CON is one of the

    oldest continuous running hacker conventions around, and also one of the largest.” - DEF CON FAQ
  2. What is DEF CON? “Black Hat… is more the university…

    DEF CON is the fraternity party.” - USA Today, “Suits and punks convene in Las Vegas for hacker conferences,” Aug. 1 2006
  3. Attack-Defense CTF 1. Hack services 2. Steal tokens every round

    3. Get points 1. Patch services 2. Pass SLA checks 3. Don’t lose points
  4. Competing in CTF •Build a team •Get really good at

    assembly •Get good at web vulns and crypto too •Compete and solve problems •Write up solutions
  5. Team Building •Opinionated smart people •That need to work together

    •On a software project with dozens of moving parts •On a very public stage •With immovable deadlines
  6. Quals Problems I slept… Through a part where we had

    to edit a question and put something on S3.
  7. Quals •IRC and Twitter: invaluable •Have a reset password flow

    •Don’t forget public views •Fight bus numbers
  8. Finals •Attack-defense style •Teams get a server running services •Find

    vulnerabilities in services •Patch own vulnerabilities •Exploit vulnerabilities on other teams
  9. Finals Scoring Fifty-thousand flags Five-minute rounds Tokens from services redeemed

    for flags Flags lost when stolen and downtime Zero-sum for game theory reasons
  10. Finals Scoreboard Rails, Apache, Passenger, Postgres Ubuntu on Mac Mini

    HTTPS Client Certificates Kibana (Logstash, Elasticsearch) No push, no polling, just meta refresh
  11. Finals Scoreboard Client certs rule No password resets No hacking,

    no sniffing Twenty CDs of certs and keys… eh
  12. Tokens and Uptime Console Ruby script Restartable in a sensible

    fashion Use Postgres and wall clock time as state Save immediately, don’t queue
  13. Tokens and Uptime Two weeks prior: “I’m just going to

    call a shell script, everyone else write your own uptime checker.”
  14. Tokens and Uptime Three hours in: “Uh, how do we

    make these shell scripts time out?”
  15. Finals Problems Have a better way to find issues than

    rails console, SQL, and log queries