Common Oops in DevOps

DevOps missing security manual

Vlatko Kosturjak (@k0st), FSEC, Varaždin, 15th of September

Agenda

  • Introduction
  • Secure communication
  • Development
  • Deployment
  • Configuration
  • Passwords
  • Summary
  • Questions and answers

45 minutes

About me

  • Security Consultant in Diverto
  • Open source (security) developer
  • Securing DevOps
    • Helping clients in DevOps security
    • Having fun finding problems

Introduce elephant

  • Talk will cover
    • Common mistakes
    • development
    • deployments
    • continuos integration
    • password and/or secret management
  • Talk is NOT
    • comprehensive security manual
    • applicable to any DevOps case, YMMV

Secure Communication

Security requirements

Git awareness

  • Commit author and e-mail can be impersonated
    • You can change to be anyone
    • You still need credentials to push, but merge request is fun :)
    • git config --global user.name "HD Moore"
    • git config --global user.email hd_moore@rapid7.com
  • Hooks
    • do not blindly copy hooks from others :)
    • .git/hooks/post-checkout
    • .git/hooks/post-commit

Github Data Scraping

  • Creating realworld wordlists from github hosted data
  • References
    • All directories found inside of github projects
    • All files found inside of github projects
    • All usernames found from email addresses
    • Passwords found within github projects
    • static salts found within github projects
  • References

Issue Scraping

  • open source trackers hold potential 0-days
  • just need to find correct ones
  • security issues are reported and public
  • Simple Example
    • scrape issues and find GDB dump where EIP is 0x41414141
  • References

Issue Scraping

Issue Recommendations

Internal or your own repo

Middleware

  • Open application server consoles
    • deploy own code
  • Easy passwords on application server consoles
    • tomcat/tomcat? :)
    • deploy own code
  • It works for almost all consoles
    • JBoss, Tomcat, Weblogic, Websphere, ...
  • References

Be careful how you deploy

  • Data files
    • Insecure object references
  • Backup files
    • bak
    • filename~
  • DVCS files
    • .git
    • .svn

Source code ripping - easy

  • Easy if directory browsing enabled
mkdir git-test 
cd git-test 
wget --mirror --include-directories=/.git http://www.target.com/.git 
cd www.target.com
git reset --hard
  • http://www.skullsecurity.org/blog/2012/using-git-clone-to-get-pwn3d
  • http://www.slideshare.net/kost/wonderful-world-of-distributed-scm-or-vcs
  • https://k0st.wordpress.com/2012/10/23/rip-or-pillage-dvcs-story-about-git/
  • State of Source code ripping

    • When directory browsing is disabled
    DVCS Info Source
    CVS yes no
    SVN yes mostly
    Git yes mostly
    Mercurial (hg) yes yes
    Bazaar (bzr) yes yes

    Source Ripping tools

    Source Code recommendations

    • Prevent Serving from web server
    <DirectoryMatch .svn>
    	Order allow,deny 
    	Deny from all
    </DirectoryMatch>
  • Periodic check
    • find /web -name .svn
    • find /web -name .git
  • Config files
    • Config.php vs config.php-dist

    Vagrant

    • wrapper around VirtualBox, VMware and KVM
    • provision virtual machines quickly
    • mostly used by developers
      • complete development environment
      • deterministic results
    • References

    Vagrant common problems

    • default credentials
      • root/vagrant
      • vagrant/vagrant
    • default SSH keys
      • private SSH key

    Vagrant recommendations

    • Change default credentials
      • root/vagrant
      • vagrant/vagrant
    • Change default SSH keys
      • private SSH key

    Docker

    • Stay tuned for next lecture

    Jenkins

    • No authentication
      • easy to get remote code execution
      • exploit/multi/http/jenkins_script_console
    • Local authentication
      • register as new user
      • get access to script console
      • /view/All/newJob => new build => run

    Jenkins

    • Implement authentication
    • Rework ACLs

    Few other things

    Password and secret management

    • Get rid of Passwords
    • Yes, it's hard to remove them all
      • There are still passwords somewhere and API keys
      • Secret management solutions
    • Config files
      • Config.php vs config.php-dist

    Secret management solutions

    Summary

    • History repeats itself
    • Common fails are not rocket science
      • Nothing spectacular
      • Basic security things
    • Automatization
      • You can automate parts of DevOps Security
      • Still some manual parts

    Thanks on listening

    ?

    Any questions?

    @k0st

    Common Oops in DevOps

    By k0st

    Common Oops in DevOps

    DevOps missing security manual

    • 2,065