Top Banner
Rugged Driven Development with Gauntlt @wickett // @gauntlt // gauntlt.org
57

Rugged Driven Development with Gauntlt

Oct 19, 2014

Download

Technology

Talk from LASCON 2013.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Rugged Driven Development with Gauntlt

Rugged Driven Development with Gauntlt

@wickett // @gauntlt // gauntlt.org

Page 2: Rugged Driven Development with Gauntlt

@wickett

• Austin, TX

• LASCON Founder

• DevOps Days Organizer

• DevOps, AppSec, Ruby, Chef, Cucumber

@wickett // @gauntlt // gauntlt.org

Page 3: Rugged Driven Development with Gauntlt

Work like a Captain

Play like a Pirate

@wickett // @gauntlt // gauntlt.org

Page 4: Rugged Driven Development with Gauntlt

So far, infosec is good at the pirate part...

@wickett // @gauntlt // gauntlt.org

Page 5: Rugged Driven Development with Gauntlt

@wickett // @gauntlt // gauntlt.org

Page 6: Rugged Driven Development with Gauntlt

Gauntlt is Rugged Theology

Applied

@wickett // @gauntlt // gauntlt.org

Page 7: Rugged Driven Development with Gauntlt

rugged

@wickett // @gauntlt // gauntlt.org

Page 8: Rugged Driven Development with Gauntlt

@wickett // @gauntlt // gauntlt.org

Page 9: Rugged Driven Development with Gauntlt

http://www.slideshare.net/wickett/putting-rugged-into-your-devops-toolchain

@wickett // @gauntlt // gauntlt.org

Page 10: Rugged Driven Development with Gauntlt

Rugged & DevOps

Page 13: Rugged Driven Development with Gauntlt

Gauntlt is Rugged Theology

Applied

@wickett // @gauntlt // gauntlt.org

Page 14: Rugged Driven Development with Gauntlt

security tools today

@wickett // @gauntlt // gauntlt.org

Page 15: Rugged Driven Development with Gauntlt

Core Tenets of Gauntlt

• Facilitate communication between Infosec and Dev and Ops

• Cultural shift from compliance driven, auditor-led security

• Build a new language and currency in organizations

@wickett // @gauntlt // gauntlt.org

Page 16: Rugged Driven Development with Gauntlt

gauntlt connects people

@wickett // @gauntlt // gauntlt.org

Page 19: Rugged Driven Development with Gauntlt
Page 20: Rugged Driven Development with Gauntlt

github.com/gauntlt

Page 21: Rugged Driven Development with Gauntlt
Page 22: Rugged Driven Development with Gauntlt

Our Philosophy• Run security tools in a repeatable, easy to

read way

• Handle stdin, stdout, exit status

• Favor speed and utility over complexity and slowness

• Be part of the pipeline (CI/CD)

• We aren’t package managers... install your own tools

@wickett // @gauntlt // gauntlt.org

Page 23: Rugged Driven Development with Gauntlt

Let’s be Captains

@wickett // @gauntlt // gauntlt.org

Page 24: Rugged Driven Development with Gauntlt

Install your own tools

you are in fact a captain, right?

@wickett // @gauntlt // gauntlt.org

Page 25: Rugged Driven Development with Gauntlt

$ rvm --ruby-version use 1.9.3

optional, but recommended@wickett // @gauntlt // gauntlt.org

Page 26: Rugged Driven Development with Gauntlt

$ mkdir lascon$ cd ./lascon$ vim Gemfile

optional, but recommended@wickett // @gauntlt // gauntlt.org

Page 27: Rugged Driven Development with Gauntlt

# Gemfile

source ‘https://rubygems.org’

gem ‘gauntlt’

optional, but recommended@wickett // @gauntlt // gauntlt.org

Page 28: Rugged Driven Development with Gauntlt

$ bundle

optional, but recommended@wickett // @gauntlt // gauntlt.org

Page 29: Rugged Driven Development with Gauntlt

$ bundleFetching gem metadata from https://rubygems.org/..........Fetching gem metadata from https://rubygems.org/..Resolving dependencies...Using ffi (1.9.0)Using childprocess (0.3.9)Using builder (3.2.2)Using diff-lcs (1.2.4)Using multi_json (1.8.2)Using gherkin (2.12.2)Using multi_test (0.0.2)Using cucumber (1.3.8)Using rspec-expectations (2.14.3)Using aruba (0.5.3)Using nokogiri (1.5.10)Using trollop (2.0)Using gauntlt (1.0.6)Using bundler (1.3.5)Your bundle is complete!Use `bundle show [gemname]` to see where a bundled gem is installed.

optional, but recommended@wickett // @gauntlt // gauntlt.org

Page 30: Rugged Driven Development with Gauntlt

$ gem install gauntlt

@wickett // @gauntlt // gauntlt.org

Page 31: Rugged Driven Development with Gauntlt

Future slides will use:

$ gauntlt

but, really it is:

$ bundle exec gauntlt

@wickett // @gauntlt // gauntlt.org

Page 32: Rugged Driven Development with Gauntlt

$ touch example.attack

@wickett // @gauntlt // gauntlt.org

Page 33: Rugged Driven Development with Gauntlt

Feature: nmap attacks for example.com Background: Given "nmap" is installed And the following profile: | name | value | | hostname | example.com |

Scenario: Verify server is open on expected ports When I launch an "nmap" attack with: """ nmap -F <hostname> """ Then the output should contain: """ 80/tcp open http """ Scenario: Verify that there are no unexpected ports open When I launch an "nmap" attack with: """ nmap -F <hostname> """ Then the output should not contain: """ 25/tcp """

Given

When

Then

When

Then

@wickett // @gauntlt // gauntlt.org

Page 34: Rugged Driven Development with Gauntlt

running gauntlt with failing tests

$ gauntlt

Feature: nmap attacks for example.com

Background: Given "nmap" is installed And the following profile: | name | value | | hostname | example.com |

Scenario: Verify server is open on expected ports When I launch an "nmap" attack with: """ nmap -F www.example.com """ Then the output should contain: """ 443/tcp open https """

1 scenario (1 failed)5 steps (1 failed, 4 passed)0m18.341s

@wickett // @gauntlt // gauntlt.org

Page 35: Rugged Driven Development with Gauntlt

$ gauntlt

Feature: nmap attacks for example.com

Background: Given "nmap" is installed And the following profile: | name | value | | hostname | example.com |

Scenario: Verify server is open on expected ports When I launch an "nmap" attack with: """ nmap -F www.example.com """ Then the output should contain: """ 443/tcp open https """

1 scenario (1 passed)4 steps (4 passed)0m18.341s

running gauntlt with passing tests

@wickett // @gauntlt // gauntlt.org

Page 36: Rugged Driven Development with Gauntlt

$ gauntlt --list

Defined attacks: arachni curl dirb garmr generic nmap sqlmap sslyze

@wickett // @gauntlt // gauntlt.org

Page 37: Rugged Driven Development with Gauntlt

$ gauntlt --steps/^"(\w+)" is installed in my path$//^"arachni" is installed$//^"curl" is installed$//^"dirb" is installed$//^"garmr" is installed$//^"nmap" is installed$//^"sqlmap" is installed$//^"sslyze" is installed$//^I launch (?:a|an) "arachni" attack with:$//^I launch (?:a|an) "arachni-(.*?)" attack$//^I launch (?:a|an) "curl" attack with:$//^I launch (?:a|an) "dirb" attack with:$//^I launch (?:a|an) "garmr" attack with:$//^I launch (?:a|an) "generic" attack with:$//^I launch (?:a|an) "nmap" attack with:$//^I launch (?:a|an) "nmap-(.*?)" attack$//^I launch (?:a|an) "sqlmap" attack with:$//^I launch (?:a|an) "sslyze" attack with:$//^the "(.*?)" command line binary is installed$//^the DIRB_WORDLISTS environment variable is set$//^the file "(.*?)" should contain XML:$//^the file "(.*?)" should not contain XML:$//^the following cookies should be received:$//^the following environment variables:$//^the following profile:$/

Page 38: Rugged Driven Development with Gauntlt

$ gauntlt --help

$ gauntlt --allsteps

@wickett // @gauntlt // gauntlt.org

Page 39: Rugged Driven Development with Gauntlt

https://github.com/gauntlt/gauntlt/wiki/Output-parsing-with-Gauntlt

@wickett // @gauntlt // gauntlt.org

Page 40: Rugged Driven Development with Gauntlt

https://github.com/gauntlt/gauntlt/wiki/Output-parsing-with-Gauntlt

@wickett // @gauntlt // gauntlt.org

Page 41: Rugged Driven Development with Gauntlt

RegEx in Gauntlt

Then the output should match /80.tcp\s+open/

Then the output should match:

"""

80\/tcp\s+open

"""

@wickett // @gauntlt // gauntlt.org

Page 42: Rugged Driven Development with Gauntlt

Create network.attack

@slowFeature: check to make sure the right ports are open on our server

Background: Given "nmap" is installed And the following profile: | name | value | | host | lascon.org |

Scenario: Verify server is open on expected ports When I launch an "nmap-fast" attack Then the output should match /80.tcp\s+open/

https://gist.github.com/7121100@wickett // @gauntlt // gauntlt.org

Page 43: Rugged Driven Development with Gauntlt

$ gauntlt@slowFeature: check to make sure the right ports are open on our server

Background: # network.attack:4 Given "nmap" is installed # gauntlt-1.0.6/lib/gauntlt/attack_adapters/nmap.rb:4 And the following profile: # gauntlt-1.0.6/lib/gauntlt/attack_adapters/gauntlt.rb:9 | name | value | | host | lascon.org |

Scenario: Verify server is open on expected ports # network.attack:10Running a nmap-fast attack. This attack has this description: This is a fast nmap scan that should run in 10 seconds or less on most networks. It looks for the most common ports and services. When I launch an "nmap-fast" attack # gauntlt-1.0.6/lib/gauntlt/attack_adapters/nmap.rb:12 Then the output should match /80.tcp\s+open/ # aruba-0.5.3/lib/aruba/cucumber.rb:137

1 scenario (1 passed)4 steps (4 passed)0m4.799s

@wickett // @gauntlt // gauntlt.org

Page 44: Rugged Driven Development with Gauntlt

Create directory.attack@slowFeature: make sure our website doesn't expose sensitive directories

Scenario: Start with using dirb and check for default apache directories Given "dirb" is installed And the following profile: | name | value | | hostname | http://lascon.org | | wordlist | /opt/wordlists/vulns/apache.txt | When I launch a "dirb" attack with: """ dirb <hostname> <dirb_wordlists_path>/<wordlist> """ Then the output should contain: """ FOUND: 0 """ http://gist.github.com/7124575

Page 45: Rugged Driven Development with Gauntlt

@slowFeature: make sure our website doesn't expose sensitive directories

Scenario: Start with using dirb and check for default apache directories # directory.attack:4 Given "dirb" is installed # gauntlt-1.0.6/lib/gauntlt/attack_adapters/dirb.rb:1 And the following profile: # gauntlt-1.0.6/lib/gauntlt/attack_adapters/gauntlt.rb:9 | name | value | | hostname | http://lascon.org | | wordlist | vulns/apache.txt | When I launch a "dirb" attack with: # gauntlt-1.0.6/lib/gauntlt/attack_adapters/dirb.rb:9 """ dirb <hostname> <dirb_wordlists_path>/<wordlist> """ Then the output should contain: # aruba-0.5.3/lib/aruba/cucumber.rb:113 """ FOUND: 0 """

1 scenario (1 passed)4 steps (4 passed)0m23.878s

Page 46: Rugged Driven Development with Gauntlt

captains need dashboards

@wickett // @gauntlt // gauntlt.org

Page 47: Rugged Driven Development with Gauntlt

bundle exec gauntlt --format html > out.html

@wickett // @gauntlt // gauntlt.org

Page 48: Rugged Driven Development with Gauntlt

XSS

...looks cool in this font

@wickett // @gauntlt // gauntlt.org

Page 49: Rugged Driven Development with Gauntlt

$ vim Gemfile

gem ‘arachni’

$ bundle

@wickett // @gauntlt // gauntlt.org

Page 50: Rugged Driven Development with Gauntlt

Create xss.attack

https://gist.github.com/7121728

@slowFeature: Look for cross site scripting (xss) using arachni against a URL

Scenario: Using the arachni, look for cross site scripting and verify no issues are found Given "arachni" is installed And the following profile: | name | value | | url | http://lascon.org | When I launch an "arachni-simple_xss" attack Then the output should contain "0 issues were detected."

@wickett // @gauntlt // gauntlt.org

Page 51: Rugged Driven Development with Gauntlt

@slowFeature: Look for cross site scripting (xss) using arachni against a URL

Scenario: Using the arachni, look for cross site scripting and verify no issues are found # xss.attack:4 Given "arachni" is installed # gauntlt-1.0.6/lib/gauntlt/attack_adapters/arachni.rb:1 And the following profile: # gauntlt-1.0.6/lib/gauntlt/attack_adapters/gauntlt.rb:9 | name | value | | url | http://lascon.org |Running a arachni-simple_xss attack. This attack has this description: This is a scan for cross site scripting (xss) that only runs the base xss module in arachni. The scan only crawls one level deep which makes it faster. For more depth, run the gauntlt attack alias 'arachni-simple_xss_with_depth' and specifiy depth.The arachni-simple_xss attack requires the following to be set in the profile: ["<url>"] When I launch an "arachni-simple_xss" attack # gauntlt-1.0.6/lib/gauntlt/attack_adapters/arachni.rb:9 Then the output should contain "0 issues were detected." # aruba-0.5.3/lib/aruba/cucumber.rb:97

1 scenario (1 passed)4 steps (4 passed)0m7.991s

@wickett // @gauntlt // gauntlt.org

Page 52: Rugged Driven Development with Gauntlt

Other attacks

• Garmr

• HTTP Methods (CURL)

• REST Testing (jerry curl / CURL)

• SQL Injection (sqlmap and arachni)

@wickett // @gauntlt // gauntlt.org

Page 53: Rugged Driven Development with Gauntlt

Resources

• Google Group > https://groups.google.com/d/forum/gauntlt

• Wiki > https://github.com/gauntlt/gauntlt/wiki

• IRC > #gauntlt on freenode

• Weekly hangout > http://bit.ly/gauntlt-hangout

• Issue tracking > http://github.com/gauntlt/gauntlt

@wickett // @gauntlt // gauntlt.org

Page 54: Rugged Driven Development with Gauntlt
Page 55: Rugged Driven Development with Gauntlt
Page 56: Rugged Driven Development with Gauntlt

Future dev work

• Moar Attack Aliases!

• Bring your own Attack Aliases

• Bring your own Attacks

• Gauntlt Server

Page 57: Rugged Driven Development with Gauntlt

@gauntltgauntlt.org

@wickett // @gauntlt // gauntlt.org