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

Using Ruby In Security Critical Applications

Tom Macklin
November 21, 2015

Using Ruby In Security Critical Applications

A description of principles for designing and implementing security controls in security critical systems, with a special focus on rubyists. Also lists some research objectives for improving ruby security. The presentation is breadth over depth and has lots of links to related information. From RubyConf 2015 in San Antonio, TX

Tom Macklin

November 21, 2015
Tweet

Other Decks in Technology

Transcript

  1. DISCLAIMER This talk represents MY personal opinions based on MY

    personal AND professional experience, and is in NO WAY representative of the NRL, US Navy, or US Government!
  2. + Separate databases with OS access policies Logic servers mediating

    write operations MAC data separation! = Admin DB n1 n1 n2 DB DB DB DB DB n1 n3 n1 n2 n3 Database(s) n2 Network Application Server mlsqlite Reference Monitor Write requests Logic svr Logic svr Logic svr Logic svr
  3. Read Only permissions Simple router to the writers Enforced by

    OS OS integrity checking*** => => => => Check! Nonbypassable Evaluatable Always Invoked Tamper Evident *** TMI for this talk...
  4. Takeaways Abstract OS “hooks” with FFI Stub OS controls for

    development Don’t give your app system privileges
  5. Next Steps • Better OS Unit test/double “tools” a la

    http://mock-server.com • Rust integration when type safety is needed e.g., http://brson.github.io/2013/03/10/ embedding-rust-in-ruby
  6. + least privilege process separation DSL-based pre and post content

    filters process & storage self protection =
  7. Separate process storage Small, simple, separate Monkeypatched into class ‘;’

    present at storage => app is broken => => => => Check! Nonbypassable Evaluatable Always Invoked Tamper Evident
  8. • ANTLR and Parselet http://antlr.org http://kschiess.github.io/parslet/ • checksec.sh - compile

    time protections http://trapkit.de/tools/checksec.html • PoC || GTFO - fun security publication https://www.alchemistowl.org/ pocorgtfo/ Other Cool Techs
  9. Takeaways DSLs are great for content filtering Make simple checks

    at enforcement point Also, “TOCTOU” considerations... Learn how successful attacks work http://lmgtfy.com/?q=matt+honan+wired+hack
  10. Next Steps • I/O sanitization “monad” hamster gem, $SAFE, ???

    “Refactoring Ruby with Monads” talk • “spec2filter” Convert “standard” formats to rule sets spec2filter rfc822.txt > smtp_filter.yaml
  11. + use OS to isolate validation “layers” assured and contained

    content validation = software fault isolation, binary diversity REXML- Well Formedness Nokogiri- Validation DSL- Content
  12. OS separated “pipeline” a good flog score... override ‘as_xml()’ SECCOMP

    monitoring => => => => Check! Nonbypassable Evaluatable Always Invoked Tamper Evident ~
  13. Next Steps (better) SECCOMP integration “Robusta” style for cruby FFI-SFI

    http://www.cse.lehigh.edu/~gtan/paper/ robusta.pdf mruby in buildroot toolchain
  14. • Giving info increases coverage, saves $ • Build relations

    with your pen testers Especially rules of engagement... Buying Penetration Testing: and...
  15. • Test at the correct layer FOR EACH CONTROL! Otherwise

    you’re testing the outside layers much more We don’t do unit testing like that!?!
  16. safety vs security? • positive vs. negative principles • simplicity

    and modularity are hardest • nature versus human creativity