Move fast and secure things About Me $whoami Security engineer @ - - PowerPoint PPT Presentation

move fast and secure things
SMART_READER_LITE
LIVE PREVIEW

Move fast and secure things About Me $whoami Security engineer @ - - PowerPoint PPT Presentation

Move fast and secure things About Me $whoami Security engineer @ Fb > 2 years Security consultant I <3 CTFs (LC/BC) I <3 server side bugs and automating the detection @the_st0rm Agenda Setting the scene


slide-1
SLIDE 1

Move fast and secure things

slide-2
SLIDE 2

About Me

$whoami

– Security engineer @ Fb > 2 years – Security consultant – I <3 CTFs (LC/BC) – I <3 server side bugs and automating the detection – @the_st0rm

slide-3
SLIDE 3
  • Agenda

– Setting the scene – Securing the codebase – Example of rules – Static analysis use cases – Myth busting – Demo! :O

3

slide-4
SLIDE 4
  • Engineering @ FB

4

> 100k

commits per week

Big Code: Developer Infrastructure at Facebook's Scale https://www.facebook.com/FacebookforDevelopers/videos/10152800517193553/

slide-5
SLIDE 5
  • Engineering @ FB

5

slide-6
SLIDE 6

“Nothing at Facebook is somebody else's problem”

6

slide-7
SLIDE 7
  • Securing the codebase

– Secure frameworks – Security reviews – Automation (static and dynamic analysis) – Whitehat

7

slide-8
SLIDE 8
  • Secure frameworks

– XHP – Hack – Django

  • Limitations

– Enforcement – Depends on the engineer

8

slide-9
SLIDE 9
  • Manual security reviews

– Find cool bugs

  • Limitations

– Time consuming – Does not scale – Completeness

9

slide-10
SLIDE 10
  • Automation (Program analysis)

– Scales – Find low hanging fruits – And difficult bugs (Fuzzing) – Continuous detection [+ prevention]

  • Limitations

– False positives and negatives – Difficult to get right

10

slide-11
SLIDE 11
  • Whitehat

– Continuous detection – Very unique bugs/talent

  • Limitations

– Test in prod! – Expensive for small companies? – Signal to noise ratio

11

slide-12
SLIDE 12

Automation (static analysis)

12

slide-13
SLIDE 13
  • Automation (static analysis)

– Scale

– Tens of millions LoC – Thousand commits/day

– Performance

  • No run-time overhead (e.g fuzzing)
  • Grepping millions of LoC

– Completeness – Proactive vs Reactive

13

slide-14
SLIDE 14
  • Static analysis design

14

new bug can do with SA? Yes No Oops add a rule refine with SWE triage master monitor diffs bug is dead whitehat security review

slide-15
SLIDE 15
  • Tips to build good static analysis

– Coverage

  • Understand the attack surface
  • Define sources
  • Define sinks

– Simplicity

  • Easy to use
  • Configuring the sources/sinks
  • Adding sanitizers

15

slide-16
SLIDE 16
  • Tips to build good static analysis

– Improving signal

  • Excluding False positives
  • Finding false negatives

– Feedback to the framework – Speed

16

slide-17
SLIDE 17
  • Security vulnerabilities we detect

– We can currently detect more than 20 types of security issues including

  • Higher-order command injection
  • HTTP status codes as privacy oracles
  • Arbitrary file reads/writes
  • Server-side Request Forgery (SSRF)
  • SQL
  • XSS

17

slide-18
SLIDE 18
  • Bug detection - Arbitrary file reads/writes

– Filename going to dangerous function

18

slide-19
SLIDE 19
  • Bug detection - command injection

19

$t = attacker_controlled(); // … many lines … execx(“zip %s”, $t);

$t = attacker_controlled(); // … execx(“zip a.zip -T '--unzip-command=%s'”, $t);

  • Commands can execute other commands
  • Static analysis tool can understand format string
  • Secure because of high-quality frameworks
slide-20
SLIDE 20
  • Bug detection - Privacy oracles

20

$group_id = attacker_controlled(); if ($group_id === 100) throw HTTP_404(); $group_id = attacker_controlled(); // load with privacy check $data = isMember(auth_user(), group_id); if ($data === null) throw HTTP_404();

– Static analysis can check

  • action taken under attacker control?
  • action is influenced by privacy check?
slide-21
SLIDE 21
  • Use cases

– Regular analysis

  • Triaged by security engineers
  • Triaged by team owners

– On-demand analysis

  • Whitehat report
  • Security reviews
slide-22
SLIDE 22
  • Use cases

– Diff analysis

  • Analyze base repo
  • Analyze base repo + diff
  • Find new issues
  • High confidence issues => auto comment
  • Mid confidence => Oncall/product team
slide-23
SLIDE 23
  • Myth busting

– Does it scale?

  • 20 mins for 10s millions of LoC

– Is it precise?

  • “Static analyzers are noisy”

– Is it useful?

  • “They only find trivial errors”

23

slide-24
SLIDE 24
  • Analysis dashboard

24

slide-25
SLIDE 25

– Pyre is a fast, scalable type checker for large Python 3 codebases – Open source

  • Python static analysis?
  • Demo?

pyre-check.org

  • Have you heard about Pyre?

25

slide-26
SLIDE 26

We are hiring <3

26

slide-27
SLIDE 27

Questions?

27