Web applica*on security for dynamic languages - - PowerPoint PPT Presentation

web applica on security for
SMART_READER_LITE
LIVE PREVIEW

Web applica*on security for dynamic languages - - PowerPoint PPT Presentation

Web applica*on security for dynamic languages zane@etsy.com @zanelackey Who am I? Security Engineering Manager @ Etsy Lead AppSec/NetSec/SecEng teams


slide-1
SLIDE 1

Web ¡applica*on ¡security ¡for ¡ dynamic ¡languages ¡

¡ ¡

zane@etsy.com ¡ @zanelackey ¡

slide-2
SLIDE 2

Who ¡am ¡I? ¡ ¡

  • Security ¡Engineering ¡Manager ¡@ ¡Etsy ¡

– Lead ¡AppSec/NetSec/SecEng ¡teams ¡ ¡

  • Formerly ¡@ ¡iSEC ¡Partners ¡ ¡
  • Books/presenta*ons ¡primarily ¡focused ¡on ¡

applica*on ¡and ¡mobile ¡security ¡ ¡ ¡ ¡

slide-3
SLIDE 3

What ¡is ¡Etsy? ¡

¡ ¡ Online ¡marketplace ¡for ¡crea*ve ¡independent ¡ businesses ¡ ¡ ¡ ¡

slide-4
SLIDE 4

Scale ¡at ¡Etsy ¡

¡

1.5B ¡pageviews/mo ¡ 40M ¡uniques/mo ¡ #50 ¡by ¡US ¡traffic* ¡

¡

¡ ¡

* ¡November2012, ¡Alexa ¡site ¡ranking ¡ ¡

slide-5
SLIDE 5

About ¡this ¡talk ¡ ¡

¡ ¡ Real ¡world ¡approaches ¡to ¡web ¡applica*on ¡ security ¡challenges ¡ ¡ ¡

slide-6
SLIDE 6

About ¡this ¡talk ¡ ¡

¡ ¡ Specifically, ¡techniques ¡that ¡are ¡simple ¡and ¡ effec*ve ¡ ¡ ¡

slide-7
SLIDE 7

¡ ¡ Con*nuous ¡deployment? ¡

slide-8
SLIDE 8

<-­‑ ¡What ¡it ¡ (hopefully) ¡ isn’t ¡ ¡

slide-9
SLIDE 9

¡ ¡ Three ¡words: ¡iterate, ¡iterate, ¡iterate ¡

slide-10
SLIDE 10
slide-11
SLIDE 11

¡ ¡ Etsy ¡pushes ¡to ¡produc*on ¡30 ¡*mes ¡a ¡day ¡on ¡ average ¡ ¡

slide-12
SLIDE 12

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(dogs ¡push ¡too) ¡ ¡

slide-13
SLIDE 13

¡ ¡ But ¡doesn’t ¡the ¡rapid ¡ rate ¡of ¡change ¡mean ¡ things ¡are ¡less ¡ secure?! ¡

slide-14
SLIDE 14

Actually, ¡the ¡opposite ¡is ¡ true ¡

slide-15
SLIDE 15

¡ ¡

Being ¡able ¡to ¡deploy ¡quick ¡is ¡our ¡#1 ¡security ¡ feature ¡ ¡

¡

slide-16
SLIDE 16

Compared ¡to ¡ ¡

¡ We’ll ¡rush ¡that ¡security ¡fix. ¡ ¡It ¡will ¡go ¡out ¡in ¡the ¡ next ¡release ¡in ¡about ¡6 ¡weeks. ¡ ¡

  • ­‑ ¡Former ¡vendor ¡at ¡Etsy ¡
slide-17
SLIDE 17

What ¡it ¡boils ¡down ¡to ¡ (spoiler ¡alert) ¡ ¡

  • Make ¡things ¡safe ¡by ¡default ¡
  • Detect ¡risky ¡func*onality ¡/ ¡Focus ¡your ¡efforts ¡ ¡
  • Automate ¡the ¡easy ¡stuff ¡
  • Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡

¡ ¡

slide-18
SLIDE 18

¡ ¡

Safe ¡by ¡default ¡

slide-19
SLIDE 19

¡ ¡

How ¡have ¡the ¡tradi*onal ¡defenses ¡for ¡XSS ¡ worked ¡out? ¡ ¡ ¡

¡

slide-20
SLIDE 20
slide-21
SLIDE 21

Safe ¡by ¡default ¡

  • Problems? ¡ ¡

– Ofen ¡done ¡on ¡a ¡per-­‑input ¡basis ¡

  • Easy ¡to ¡miss ¡an ¡input ¡or ¡output ¡ ¡

– May ¡use ¡defenses ¡in ¡wrong ¡context ¡

  • Input ¡valida*on ¡pagern ¡may ¡block ¡full ¡HTML ¡injec*on, ¡but ¡

not ¡injec*ng ¡inside ¡JS ¡

– May ¡put ¡defenses ¡on ¡the ¡client ¡side ¡in ¡JS ¡ – Etc ¡… ¡

These ¡problems ¡miss ¡the ¡point ¡

slide-22
SLIDE 22

Safe ¡by ¡default ¡

  • The ¡real ¡problem ¡is ¡that ¡it’s ¡hard ¡to ¡find ¡where ¡

protec*ons ¡have ¡been ¡missed ¡ ¡

¡ ¡

  • How ¡can ¡we ¡change ¡our ¡approach ¡to ¡make ¡it ¡

simpler? ¡ ¡

slide-23
SLIDE 23

Safe ¡by ¡default ¡

¡ ¡ Input ¡valida*on ¡ Output ¡encoding ¡

slide-24
SLIDE 24

Safe ¡by ¡default ¡

¡ ¡ Input ¡valida*on ¡ Output ¡encoding ¡

slide-25
SLIDE 25

Safe ¡by ¡default ¡

¡ Encode ¡dangerous ¡HTML ¡characters ¡to ¡HTML ¡ en**es ¡at ¡the ¡very ¡start ¡of ¡your ¡framework ¡ ¡ ¡ To ¡repeat… ¡Before ¡input ¡reaches ¡main ¡ applica*on ¡code ¡ ¡

slide-26
SLIDE 26

Safe ¡by ¡default ¡

¡ ¡ ¡ On ¡the ¡surface ¡this ¡doesn’t ¡seem ¡like ¡much ¡of ¡a ¡ change ¡

slide-27
SLIDE 27

Safe ¡by ¡default ¡

¡ ¡ ¡ Except, ¡we’ve ¡just ¡made ¡lots ¡of ¡XSS ¡problems ¡ grep-­‑able ¡

slide-28
SLIDE 28

¡ ¡ ¡

slide-29
SLIDE 29

Safe ¡by ¡default ¡

Now ¡we ¡look ¡for ¡a ¡small ¡number ¡of ¡pagerns: ¡

  • HTML ¡en*ty ¡decoding ¡func*ons ¡or ¡explicit ¡string ¡

replacements ¡

  • Data ¡in ¡formats ¡that ¡won’t ¡be ¡sani*zed ¡ ¡

– Ex: ¡Base64 ¡encoded, ¡double ¡URL ¡encoded, ¡etc ¡

  • Code ¡that ¡opts ¡out ¡of ¡plalorm ¡protec*ons ¡
slide-30
SLIDE 30

Safe ¡by ¡default ¡

Fundamentally ¡shifs ¡us: ¡ ¡From: ¡“Where ¡is ¡my ¡app ¡missing ¡protec*ons?” ¡ (hard) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡To: ¡“Where ¡is ¡it ¡made ¡deliberately ¡unsafe?” ¡ (easy) ¡ ¡

slide-31
SLIDE 31

Safe ¡by ¡default ¡

Obviously ¡not ¡a ¡panacea ¡ ¡

– DOM ¡based ¡XSS ¡ ¡ – Javascript: ¡URLs ¡ – Can ¡be ¡a ¡pain ¡during ¡interna*onaliza*on ¡efforts ¡

slide-32
SLIDE 32

¡ ¡

Focus ¡your ¡efforts ¡

slide-33
SLIDE 33

Focus ¡your ¡efforts ¡ ¡

  • Con*nuous ¡deployment ¡means ¡code ¡ships ¡fast ¡
  • Things ¡will ¡go ¡out ¡the ¡door ¡before ¡security ¡

team ¡knows ¡about ¡them ¡

  • How ¡can ¡we ¡detect ¡high ¡risk ¡func*onality? ¡
slide-34
SLIDE 34

Detect ¡risky ¡func*onality ¡

  • Know ¡when ¡sensi*ve ¡por*ons ¡of ¡the ¡codebase ¡

have ¡been ¡modified ¡ ¡

  • Build ¡automa*c ¡change ¡aler*ng ¡on ¡the ¡

codebase ¡

– Iden*fy ¡sensi*ve ¡por*ons ¡of ¡the ¡codebase ¡ ¡ – Create ¡automa*c ¡aler*ng ¡on ¡modifica*ons ¡ ¡

slide-35
SLIDE 35

Detect ¡risky ¡func*onality ¡

  • Doesn’t ¡have ¡to ¡be ¡complex ¡to ¡be ¡effec*ve ¡
  • Approach: ¡ ¡

– sha1sum ¡sensi*ve ¡plalorm ¡level ¡files ¡ – Unit ¡tests ¡alert ¡if ¡hash ¡of ¡the ¡file ¡changes ¡ – No*fies ¡security ¡team ¡on ¡changes, ¡drives ¡code ¡ review ¡

slide-36
SLIDE 36

Detect ¡risky ¡func*onality ¡

  • At ¡the ¡plalorm ¡level, ¡watching ¡for ¡changes ¡to ¡

site-­‑wide ¡sensi*ve ¡func*onality ¡ ¡

– CSRF ¡defenses ¡ – Session ¡management ¡ ¡ – Encryp*on ¡wrappers ¡ – Login/Authen*ca*on ¡ – Etc ¡

slide-37
SLIDE 37

Detect ¡risky ¡func*onality ¡

  • At ¡the ¡feature ¡level, ¡watching ¡for ¡changes ¡to ¡

specific ¡sensi*ve ¡methods ¡

  • Iden*fying ¡these ¡methods ¡is ¡part ¡of ¡ini*al ¡

code ¡review/pen ¡test ¡of ¡new ¡features ¡

slide-38
SLIDE 38

Detect ¡risky ¡func*onality ¡

  • Watch ¡for ¡dangerous ¡func*ons ¡ ¡
  • Usual ¡candidates: ¡

– File ¡system ¡opera*ons ¡ – Process ¡execu*on/control ¡ – Encryp*on ¡/ ¡Hashing ¡ – Etc ¡

slide-39
SLIDE 39

Detect ¡risky ¡func*onality ¡

  • Unit ¡tests ¡watch ¡codebase ¡for ¡dangerous ¡

func*ons ¡ ¡

– Split ¡into ¡separate ¡high ¡risk/low ¡risk ¡lists ¡

  • Alerts ¡are ¡emailed ¡to ¡the ¡appsec ¡team, ¡drive ¡

code ¡reviews ¡ ¡ ¡

slide-40
SLIDE 40

Detect ¡risky ¡func*onality ¡

  • Monitor ¡applica*on ¡traffic ¡
  • Purpose ¡is ¡twofold: ¡

– Detec*ng ¡risky ¡func*onality ¡that ¡was ¡missed ¡by ¡ earlier ¡processes ¡ ¡ – Groundwork ¡for ¡agack ¡detec*on ¡and ¡verifica*on ¡ ¡

slide-41
SLIDE 41

Detect ¡risky ¡func*onality ¡

  • Regex ¡incoming ¡requests ¡at ¡the ¡framework ¡

– Sounds ¡like ¡performance ¡nightmare, ¡shockingly ¡ isn’t ¡ ¡

  • Look ¡for ¡HTML/JS ¡in ¡request ¡ ¡

– This ¡creates ¡a ¡huge ¡number ¡of ¡false ¡posi*ves ¡

  • That’s ¡by ¡design, ¡we ¡refine ¡the ¡search ¡later ¡
slide-42
SLIDE 42

Detect ¡risky ¡func*onality ¡

  • We ¡deliberately ¡want ¡to ¡cast ¡a ¡wide ¡net ¡to ¡see ¡

HTML ¡entering ¡the ¡applica*on ¡ ¡

  • From ¡there, ¡build ¡a ¡baseline ¡of ¡HTML ¡ ¡

– Entering ¡the ¡applica*on ¡in ¡aggregate ¡ ¡ – Received ¡by ¡specific ¡endpoints ¡

slide-43
SLIDE 43

Detect ¡risky ¡func*onality ¡

What ¡to ¡watch ¡for: ¡

– Did ¡a ¡new ¡endpoint ¡suddenly ¡show ¡up? ¡ ¡

  • A ¡new ¡risky ¡feature ¡might’ve ¡just ¡shipped ¡

– Did ¡the ¡amount ¡of ¡traffic ¡containing ¡HTML ¡just ¡ significantly ¡go ¡up? ¡ ¡

  • Worth ¡inves*ga*ng ¡ ¡
slide-44
SLIDE 44

Detect ¡risky ¡func*onality ¡

¡

Aggregate ¡increased, ¡*me ¡to ¡inves*gate ¡

slide-45
SLIDE 45

¡ ¡

Automate ¡the ¡easy ¡stuff ¡

slide-46
SLIDE 46

Automate ¡the ¡easy ¡stuff ¡

  • Automate ¡finding ¡simple ¡issues ¡to ¡free ¡up ¡

resources ¡for ¡more ¡complex ¡tasks ¡

  • Use ¡agacker ¡traffic ¡to ¡automa*cally ¡drive ¡

tes*ng ¡ ¡

  • We ¡call ¡it ¡A;ack ¡Driven ¡Tes?ng ¡
slide-47
SLIDE 47

Automate ¡the ¡easy ¡stuff ¡

  • Some ¡cases ¡where ¡this ¡is ¡useful: ¡

– Applica*on ¡faults ¡ ¡ – Reflected ¡XSS ¡ – SQLi ¡ ¡

slide-48
SLIDE 48

Automate ¡the ¡easy ¡stuff ¡

  • Applica*on ¡faults ¡(HTTP ¡5xx ¡errors) ¡
  • As ¡an ¡agacker, ¡these ¡are ¡one ¡of ¡the ¡first ¡signs ¡
  • f ¡weakness ¡in ¡an ¡app ¡

– As ¡a ¡defender, ¡pay ¡agen*on ¡to ¡them! ¡

slide-49
SLIDE 49

Automate ¡the ¡easy ¡stuff ¡

  • Just ¡watching ¡for ¡5xx ¡errors ¡results ¡in ¡a ¡lot ¡of ¡

ephemeral ¡issues ¡that ¡don’t ¡reproduce ¡

  • Instead: ¡

– Grab ¡last ¡X ¡hours ¡worth ¡of ¡5xx ¡errors ¡from ¡access ¡ logs ¡ – Replay ¡the ¡original ¡request ¡ – Alert ¡on ¡any ¡requests ¡which ¡s*ll ¡return ¡a ¡5xx ¡

slide-50
SLIDE 50

Automate ¡the ¡easy ¡stuff ¡

  • Cron ¡this ¡script ¡to ¡run ¡every ¡few ¡hours ¡
  • If ¡a ¡request ¡s*ll ¡triggers ¡an ¡applica*on ¡fault ¡

hours ¡later, ¡it’s ¡worth ¡inves*ga*ng ¡ ¡

slide-51
SLIDE 51

Automate ¡the ¡easy ¡stuff ¡

  • Similar ¡methodology ¡for ¡verifying ¡reflected ¡

XSS ¡

  • For ¡reflected ¡XSS ¡we: ¡

– Iden*fy ¡requests ¡containing ¡basic ¡XSS ¡payloads ¡ – Replay ¡the ¡request ¡ ¡ – Alert ¡if ¡the ¡XSS ¡payload ¡executed ¡ ¡

slide-52
SLIDE 52

Automate ¡the ¡easy ¡stuff ¡

  • Basic ¡payloads ¡commonly ¡used ¡in ¡tes*ng ¡for ¡

XSS: ¡

– alert() ¡ – document.write() ¡ – unescape() ¡ – String.fromCharCode() ¡ ¡ – etc ¡

slide-53
SLIDE 53

Automate ¡the ¡easy ¡stuff ¡

¡ ¡ ¡ We ¡created ¡a ¡tool ¡to ¡use ¡NodeJS ¡as ¡a ¡headless ¡ browser ¡for ¡verifica*on ¡

slide-54
SLIDE 54

Automate ¡the ¡easy ¡stuff ¡

Test ¡webserver ¡

  • 1. ¡Fetch ¡URL ¡containing ¡poten*al ¡XSS ¡
slide-55
SLIDE 55

Automate ¡the ¡easy ¡stuff ¡

Test ¡webserver ¡

  • 2. ¡Page ¡contents ¡returned ¡

to ¡a ¡temp ¡buffer, ¡not ¡ interpreted ¡yet ¡ ¡ ¡

slide-56
SLIDE 56

Automate ¡the ¡easy ¡stuff ¡

Test ¡webserver ¡

  • 3. ¡Inject ¡our ¡instrumented ¡JS ¡into ¡page ¡contents ¡

+ ¡

Our ¡JS ¡ Page ¡contents ¡

slide-57
SLIDE 57

Automate ¡the ¡easy ¡stuff ¡

Test ¡webserver ¡

  • 4. ¡Combina*on ¡of ¡instrumented ¡JS ¡+ ¡page ¡

contents ¡interpreted ¡ ¡

+ ¡

Our ¡JS ¡ Page ¡contents ¡

slide-58
SLIDE 58

Automate ¡the ¡easy ¡stuff ¡

Test ¡webserver ¡

  • 5. ¡If ¡instrumented ¡JS ¡is ¡executed, ¡alert ¡

appsec ¡team ¡for ¡review ¡

slide-59
SLIDE 59

Automate ¡the ¡easy ¡stuff ¡

  • Sample ¡instrumented ¡JS: ¡

(function() { var proxiedAlert = window.alert; window.alert = function() { location="XSSDETECTED"; }; })();

slide-60
SLIDE 60

Automate ¡the ¡easy ¡stuff ¡

  • Open ¡sourced ¡NodeJS ¡tool ¡ ¡

– hgps://github.com/zanelackey/projects ¡ ¡

  • Combine ¡this ¡approach ¡with ¡driving ¡a ¡browser ¡

via ¡Wa*r/Selenium ¡

– Make ¡sure ¡to ¡use ¡all ¡major ¡browsers ¡ ¡

slide-61
SLIDE 61

¡ ¡

Know ¡when ¡the ¡house ¡is ¡ burning ¡down ¡

slide-62
SLIDE 62

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡

Graph ¡early, ¡graph ¡oCen ¡ ¡

¡

slide-63
SLIDE 63

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ Which ¡of ¡these ¡is ¡a ¡quicker ¡way ¡to ¡spot ¡a ¡ problem? ¡ ¡ ¡

slide-64
SLIDE 64

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

slide-65
SLIDE 65

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

slide-66
SLIDE 66

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • Methodology: ¡

– Instrument ¡applica*on ¡to ¡collect ¡data ¡points ¡ – Fire ¡them ¡off ¡to ¡an ¡aggrega*on ¡backend ¡ ¡ – Build ¡individual ¡graphs ¡ – Combine ¡groups ¡of ¡graphs ¡into ¡dashboards ¡

  • We’ve ¡open ¡sourced ¡our ¡instrumenta*on ¡

library ¡

– hgps://github.com/etsy/statsd ¡ ¡

slide-67
SLIDE 67

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

slide-68
SLIDE 68

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

slide-69
SLIDE 69

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ Now ¡we ¡can ¡visually ¡spot ¡agacks ¡ ¡

slide-70
SLIDE 70

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ But ¡who’s ¡watching ¡at ¡4AM? ¡ ¡

slide-71
SLIDE 71

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • In ¡addi*on ¡to ¡data ¡visualiza*ons, ¡we ¡need ¡

automa*c ¡aler*ng ¡ ¡

  • Look ¡at ¡the ¡raw ¡data ¡to ¡see ¡if ¡it ¡exceeds ¡

certain ¡thresholds ¡

  • Works ¡well ¡for ¡graphs ¡like ¡this… ¡
slide-72
SLIDE 72

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

slide-73
SLIDE 73

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ But ¡not ¡like ¡this… ¡ ¡

slide-74
SLIDE 74

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

slide-75
SLIDE 75

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • We ¡need ¡to ¡smooth ¡out ¡graphs ¡that ¡follow ¡

usage ¡pagerns ¡

  • Use ¡exponen*al ¡smoothing ¡formulas ¡like ¡Holt-­‑

Winters ¡ ¡

  • Math ¡is ¡hard, ¡let’s ¡look ¡at ¡screenshots! ¡ ¡
slide-76
SLIDE 76

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡

slide-77
SLIDE 77

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • Now ¡that ¡we’ve ¡smoothed ¡out ¡the ¡graphs… ¡
  • Use ¡the ¡same ¡approach ¡as ¡before: ¡

– Grab ¡the ¡raw ¡data ¡ – Look ¡for ¡values ¡above/below ¡a ¡set ¡threshold ¡ ¡ – Alert ¡ ¡

slide-78
SLIDE 78

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ Alert ¡on ¡events ¡that ¡(should) ¡never ¡happen ¡ ¡

slide-79
SLIDE 79

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ Successful ¡agacks ¡don’t ¡happen ¡in ¡a ¡vacuum! ¡ They ¡generate ¡signals ¡ ¡

slide-80
SLIDE 80

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • Figure ¡out ¡what ¡the ¡signal ¡of ¡a ¡weakness ¡

being ¡iden*fied ¡looks ¡like ¡ ¡ ¡

  • Alert ¡when ¡a ¡signal ¡occurs ¡
  • Fix ¡the ¡iden*fied ¡weaknesses ¡ ¡
slide-81
SLIDE 81

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ Two ¡examples: ¡SQLi ¡and ¡code ¡execu*on ¡ ¡ ¡

slide-82
SLIDE 82

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • The ¡road ¡to ¡exploited ¡SQLi ¡is ¡ligered ¡with ¡

broken ¡queries ¡ ¡ ¡

  • 1. Watch ¡the ¡logs ¡for ¡SQL ¡syntax ¡errors ¡
  • 2. Alert ¡when ¡they ¡appear ¡
  • 3. Fix ¡the ¡lack ¡of ¡valida*on ¡allowing ¡the ¡error ¡ ¡
slide-83
SLIDE 83

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • Further ¡along ¡the ¡agack ¡process, ¡a ¡SQLi ¡agack ¡

looks ¡like… ¡your ¡database ¡

  • Sensi*ve ¡DB ¡table ¡names ¡shouldn’t ¡be ¡

showing ¡up ¡in ¡requests ¡

  • Alert ¡if ¡they ¡do! ¡ ¡
slide-84
SLIDE 84

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ A ¡funny ¡story ¡about ¡code ¡execu*on… ¡ ¡

slide-85
SLIDE 85

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • preg_replace() ¡in ¡PHP ¡has ¡an ¡interes*ng ¡

modifier ¡ ¡ “e ¡(PREG_REPLACE_EVAL) ¡If ¡this ¡modifier ¡is ¡set, ¡ preg_replace() ¡does ¡normal ¡subs*tu*on ¡of ¡ backreferences ¡in ¡the ¡replacement ¡string, ¡ ¡ evaluates ¡it ¡as ¡PHP ¡code, ¡and ¡uses ¡the ¡result ¡for ¡ replacing ¡the ¡search ¡string. ¡“ ¡

slide-86
SLIDE 86

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • preg_replace() ¡in ¡PHP ¡has ¡an ¡interes*ng ¡

modifier ¡ ¡ “e ¡(PREG_REPLACE_EVAL) ¡If ¡this ¡modifier ¡is ¡set, ¡ preg_replace() ¡does ¡normal ¡subs*tu*on ¡of ¡ backreferences ¡in ¡the ¡replacement ¡string, ¡ evaluates ¡it ¡as ¡PHP ¡code, ¡and ¡uses ¡the ¡result ¡for ¡ replacing ¡the ¡search ¡string.” ¡

slide-87
SLIDE 87

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

  • What ¡do ¡the ¡signals ¡for ¡this ¡look ¡like? ¡ ¡
slide-88
SLIDE 88

Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡ ¡

¡ ¡ ¡ You ¡can’t ¡fix ¡what ¡you’re ¡not ¡aler*ng ¡on ¡ ¡ ¡

slide-89
SLIDE 89

¡ ¡

Conclusions ¡

slide-90
SLIDE 90
slide-91
SLIDE 91

¡

¡ ¡ Have ¡the ¡ability ¡to ¡deploy/respond ¡quickly ¡

¡ ¡

slide-92
SLIDE 92
  • Make ¡things ¡safe ¡by ¡default ¡
  • Focus ¡your ¡efforts ¡/ ¡Detect ¡risky ¡func*onality ¡
  • Automate ¡the ¡easy ¡stuff ¡
  • Know ¡when ¡the ¡house ¡is ¡burning ¡down ¡ ¡
slide-93
SLIDE 93

Thanks! ¡

zane@etsy.com ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡@zanelackey ¡ ¡

slide-94
SLIDE 94

References ¡/ ¡Thanks ¡

  • DevOpsSec: ¡

hgp://www.slideshare.net/nickgsuperstar/ devopssec-­‑apply-­‑devops-­‑principles-­‑to-­‑security ¡ ¡

  • Special ¡Thanks: ¡ ¡

– Nick ¡Galbreath, ¡Dan ¡Kaminsky, ¡Marcus ¡Barczak ¡ ¡ ¡