end to end injection safety at scale
play

End-to-end Injection Safety at Scale Mike Samuel, Google Security - PowerPoint PPT Presentation

End-to-end Injection Safety at Scale Mike Samuel, Google Security Engineering March 2019 2019 | About me Security engineer @ Google Hacks libraries, tools, languages TC39 member ( JavaScript language committee ) Editor of "A Roadmap


  1. End-to-end Injection Safety at Scale Mike Samuel, Google Security Engineering March 2019 2019 |

  2. About me Security engineer @ Google Hacks libraries, tools, languages TC39 member ( JavaScript language committee ) Editor of "A Roadmap for Node.js Security" Mission: make the easiest way to express an idea in code, a secure way @mvsamuel 2019 |

  3. Trusted Types ● W3 Proposal ● Builds on 6+ years of experience within Google ● Protects Gmail, many other complex apps ● Evidence of efficacy 2019 |

  4. Trusted Types 1. Problem statement 2. Small change ⇨ big organizational effect 3. Adoption in practice 4. Early adopters welcome 2019 |

  5. "Today, a novice programmer cannot write a complex but secure application." Breaking XSS mitigations via Script Gadgets - blackhat 2017 2019 |

  6. 2019 |

  7. 2019 |

  8. 2019 |

  9. "Today, a novice programmer cannot write a complex but secure application." Breaking XSS mitigations via Script Gadgets - blackhat 2017 2019 |

  10. Reduce developers' security burden. Move it to security professionals. 2019 |

  11. Client-side JavaScript <div id=foo></div> <script> var foo = document.querySelector('#foo'); foo.innerHTML = 'raw-string'; </script> 2019 |

  12. Client-side JavaScript <meta http-equiv=... content="trusted-types p" /> <div id=foo></div> <script> var foo = document.querySelector('#foo'); foo.innerHTML = 'raw-string'; </script> 2019 |

  13. Trusted Types make Trust decisions explicit <meta http-equiv=... content="trusted-types p" /> <div id=foo></div> <script> var foo = document.querySelector('#foo'); var policy = TrustedTypes.createPolicy('p', {} ); var trusted = policy.createHTML('raw-string'); foo.innerHTML = trusted; </script> 2019 |

  14. Trusted Types make Trust decisions explicit <meta http-equiv=... content="trusted-types p" /> <div id=foo></div> <script> var foo = document.querySelector('#foo'); var policy = TrustedTypes.createPolicy('p', {} ); var trusted = policy.createHTML('raw-string'); foo.innerHTML = trusted; </script> 2019 |

  15. Trusted Types make Trust decisions explicit Our code is safe because <meta http-equiv=... content="trusted-types p" /> trust decisions are explicit & reviewed by security team <div id=foo></div> and we check trustedness <script> before doing the undoable. var foo = document.querySelector('#foo'); var policy = TrustedTypes.createPolicy('p', {} ); var trusted = policy.createHTML('raw-string'); foo.innerHTML = trusted; </script> 2019 |

  16. Step 1. Flip the switch ● Trust decisions ● Trust decisions Implicit Implicit ● No separation btw. ● No separation btw. sensitive and other sensitive and other code code ● Un-undoable acts ● Un-undoable acts ⇨ not checked checked ● Bugs non-obvious ● Bugs obvious ● Fails unsafe ● Fails safe 2019 |

  17. Step 2. Consolidate tricky code ● Trust decisions ● Trust decisions Implicit explicit ● No separation btw. ● Separation btw. sensitive and other sensitive and other code code ● Un-undoable acts ● Un-undoable acts ⇨ checked checked ● Bugs obvious ● Bugs obvious, fewer ● Fails safe ● Fails safe ● Sensitive code not scrutinized 2019 |

  18. Step 3. Automatically loop in reviewers ● Trust decisions ● Trust decisions explicit explicit ● Separation btw. ● Separation btw. sensitive and other sensitive and other code code ● Un-undoable acts ● Un-undoable acts ⇨ checked checked ● Bugs obvious, fewer ● Bugs obvious, fewer ● Fails safe ● Fails safe ● Sensitive code not ● Sensitive code scrutinized scrutinized 2019 |

  19. Lightweight process help.github.com/en/articles/about-code-owners "Code owners are automatically requested for review when someone opens a pull request that modifies code that they own." CODEOWNERS # Files under sensitive/ need extra sign-off sensitive/ @securityperson 2019 |

  20. Trusted Types make Trust decisions explicit Our code is safe because <meta http-equiv=... content="trusted-types p" /> trust decisions are explicit & reviewed by security team <div id=foo></div> and we check trustedness <script> before doing the undoable. var foo = document.querySelector('#foo'); var policy = TrustedTypes.createPolicy('p', {} ); var trusted = policy.createHTML('raw-string'); foo.innerHTML = trusted; </script> 2019 |

  21. github.com/gothinkster/realworld RealWorld React App 2019 |

  22. RealWorld React App public/index.html 2019 |

  23. RealWorld React App src/components/Article/index.js 2019 |

  24. RealWorld React App src/components/Article/index.js 2019 |

  25. RealWorld React App src/index.js 2019 |

  26. RealWorld React App src/trustedtypes.js 2019 |

  27. Tools Integration Most trust decisions in common infrastructure that is safe-by-construction: ● Template Systems (strict, contextually autoescaped) ● Sanitizers ● Programmatic Builder APIs ● Protobufs bridge server- and client-side trusted values. 2019 |

  28. Trusted Types Gets security eyes on decisions to trust Long experience migrating projects Reduces XSS payments to vulnerability hunters Proposed as web standard Available in Chrome with origin trial token Contributors in Munich, NY, Prague, Seattle, Zürich 2019 |

  29. Resources ● Early adopters: trusted-types@googlegroups.com ● Specification: github.com/WICG/trusted-types ● "Securing the Tangled Web" by C. Kern, ACM Queue 2014 @mvsamuel (Ask me about tools integration) 2019 |

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend