SlideShare una empresa de Scribd logo
1 de 16
Writing an (in)secure
      webapp
   JSCONF 2011 // Adam Baldwin
insecure webapps




          I lied - There are no “3 easy steps”
Writing (in)secure Webapps   //   JSCONF   //    MAY 2011
Introduction
    @adam_baldwin
    Co-Founder of nGenuity
    PenTester of webs
    Curator of evilpacket.net



Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Stuff to talk about

    •  Writing insecure apps

    • # Navigation

    • Output Encoding

    • Piles of other crap

Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Writing Insecure




Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Why is it so easy?

    •  Resource constrained

    • Landscape always changing

    • Engineering vs innovation


Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
#! navigation zomg


Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
# navigation
         /#http://evilpacket.net/login


                CORS is awesome



Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Cross-Site Scripting



                                  fireblog.com




Writing (in)secure Webapps   //   JSCONF        //   MAY 2011
Context Matters
    It’s not okay to just encode
    “><‘&


    <img src=#{STUFF}/>
    <img src=a onerror=CODE/>

Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
ESAPI / jquery-encoder
    $('#submit-entity-payload').click(function() {

        var payload = $('#entity-payload').val();
        $('#entity-
    container').html(
    $.encoder.encodeForHTML(payload) );

    });




Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Content Security Policy *
      Example 1: A server wants all content to come from its own domain:
      X-Content-Security-Policy: default-src 'self'



      Example 2: An auction site wants to allow images from anywhere, plugin
      content from a list of trusted media providers including a content distribution
      network, and scripts only from a server under its control hosting sanitized
      ECMAScript:


      X-Content-Security-Policy: default-src 'self'; img-src *; 
          object-src media1.example.com *.cdn.example.com; 
          script-src trustedscripts.example.com



* Firefox 4 only
  Writing (in)secure Webapps              //      JSCONF           //      MAY 2011
Other Crap That Matters

    •  Cross-Site Request Forgery

    • Clickjacking (X-Frame-Options)

    • Cookies (HTTPOnly / Secure)

    • ...

Writing (in)secure Webapps   //   JSCONF   //   MAY 2011
Questions?
info@ngenuity-is.com // ngenuity-is.com
References
nGenuity:
         http://ngenuity-is.com
Evilpacket:
         http://evilpacket.net
JavaScript-based ESAPI: An In-Depth Overview:
         https://www.owasp.org/images/0/0b/ESAPI4JS-Marcus.Niemietz.pdf
Content Security Policy:
         http://people.mozilla.com/~bsterne/content-security-policy/
jQuery Encoder:
         http://plugins.jquery.com/project/jqencoder
         http://software.digital-ritual.net/jqencoder/




  Writing (in)secure Webapps             //    JSCONF          //     MAY 2011

Más contenido relacionado

La actualidad más candente

Puppet powershell
Puppet powershellPuppet powershell
Puppet powershell
Paul Stack
 

La actualidad más candente (10)

How To Choose A Theme
How To Choose A ThemeHow To Choose A Theme
How To Choose A Theme
 
Mix-IT 2015
Mix-IT 2015Mix-IT 2015
Mix-IT 2015
 
Security and Performance - Italian WordPress Conference
Security and Performance - Italian WordPress ConferenceSecurity and Performance - Italian WordPress Conference
Security and Performance - Italian WordPress Conference
 
10 Ways to Secure WordPress
10 Ways to Secure WordPress10 Ways to Secure WordPress
10 Ways to Secure WordPress
 
Beginning WordPress Security WordCamp North Canton 2015
Beginning WordPress Security WordCamp North Canton 2015Beginning WordPress Security WordCamp North Canton 2015
Beginning WordPress Security WordCamp North Canton 2015
 
WordPress Hardening
WordPress HardeningWordPress Hardening
WordPress Hardening
 
Robust Web APIs with node.js and Express
Robust Web APIs with node.js and ExpressRobust Web APIs with node.js and Express
Robust Web APIs with node.js and Express
 
Writing Your Own WordPress Plugins - WordCamp Kansas City, 2014
Writing Your Own WordPress Plugins - WordCamp Kansas City, 2014Writing Your Own WordPress Plugins - WordCamp Kansas City, 2014
Writing Your Own WordPress Plugins - WordCamp Kansas City, 2014
 
Puppet powershell
Puppet powershellPuppet powershell
Puppet powershell
 
Rapid application development for WordPress using AWF
Rapid application development for WordPress using AWFRapid application development for WordPress using AWF
Rapid application development for WordPress using AWF
 

Similar a Writing an (in)secure webapp in 3 easy steps

Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 
HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗
Bobby Chen
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
Christian Heilmann
 

Similar a Writing an (in)secure webapp in 3 easy steps (20)

App developer as a Web developer (ROROSyd - Jul 15)
App developer as a Web developer (ROROSyd - Jul 15)App developer as a Web developer (ROROSyd - Jul 15)
App developer as a Web developer (ROROSyd - Jul 15)
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗HiUED 前端/web 發展和體驗
HiUED 前端/web 發展和體驗
 
Ionic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocksIonic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocks
 
Apache Flex and the imperfect Web
Apache Flex and the imperfect WebApache Flex and the imperfect Web
Apache Flex and the imperfect Web
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Web Application Security Reloaded for the HTML5 era
Web Application Security Reloaded for the HTML5 eraWeb Application Security Reloaded for the HTML5 era
Web Application Security Reloaded for the HTML5 era
 
Best Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppBest Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile App
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
Future of web_apps
Future of web_appsFuture of web_apps
Future of web_apps
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
 
HTML5 Can't Do That
HTML5 Can't Do ThatHTML5 Can't Do That
HTML5 Can't Do That
 
Building great mobile apps: Somethings you might want to know
Building great mobile apps: Somethings you might want to knowBuilding great mobile apps: Somethings you might want to know
Building great mobile apps: Somethings you might want to know
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopment
 
Dependency Injection in Silverlight
Dependency Injection in SilverlightDependency Injection in Silverlight
Dependency Injection in Silverlight
 
PhoneGap/Cordova
PhoneGap/CordovaPhoneGap/Cordova
PhoneGap/Cordova
 

Más de Adam Baldwin

Node Security Project - LXJS 2013
Node Security Project - LXJS 2013Node Security Project - LXJS 2013
Node Security Project - LXJS 2013
Adam Baldwin
 
JSConf 2013 Builders vs Breakers
JSConf 2013 Builders vs BreakersJSConf 2013 Builders vs Breakers
JSConf 2013 Builders vs Breakers
Adam Baldwin
 

Más de Adam Baldwin (14)

Attacking open source using abandoned resources
Attacking open source using abandoned resourcesAttacking open source using abandoned resources
Attacking open source using abandoned resources
 
JavaScript Supply Chain Security
JavaScript Supply Chain SecurityJavaScript Supply Chain Security
JavaScript Supply Chain Security
 
Building a Threat Model & How npm Fits Into It
Building a Threat Model & How npm Fits Into ItBuilding a Threat Model & How npm Fits Into It
Building a Threat Model & How npm Fits Into It
 
Hunting for malicious modules in npm - NodeSummit
Hunting for malicious modules in npm - NodeSummitHunting for malicious modules in npm - NodeSummit
Hunting for malicious modules in npm - NodeSummit
 
Continuous Security - Thunderplains 2016
Continuous Security - Thunderplains 2016Continuous Security - Thunderplains 2016
Continuous Security - Thunderplains 2016
 
Continuous Security
Continuous SecurityContinuous Security
Continuous Security
 
Nodevember 2015
Nodevember 2015Nodevember 2015
Nodevember 2015
 
The Art of Identifying Vulnerabilities - CascadiaFest 2015
The Art of Identifying Vulnerabilities  - CascadiaFest 2015The Art of Identifying Vulnerabilities  - CascadiaFest 2015
The Art of Identifying Vulnerabilities - CascadiaFest 2015
 
Node Day - Node.js Security in the Enterprise
Node Day - Node.js Security in the EnterpriseNode Day - Node.js Security in the Enterprise
Node Day - Node.js Security in the Enterprise
 
Node Security Project - LXJS 2013
Node Security Project - LXJS 2013Node Security Project - LXJS 2013
Node Security Project - LXJS 2013
 
Security First - Adam Baldwin
Security First - Adam BaldwinSecurity First - Adam Baldwin
Security First - Adam Baldwin
 
JSConf 2013 Builders vs Breakers
JSConf 2013 Builders vs BreakersJSConf 2013 Builders vs Breakers
JSConf 2013 Builders vs Breakers
 
EV1LSHA - Misadventures in the land of Lua
EV1LSHA - Misadventures in the land of LuaEV1LSHA - Misadventures in the land of Lua
EV1LSHA - Misadventures in the land of Lua
 
Pony Pwning Djangocon 2010
Pony Pwning Djangocon 2010Pony Pwning Djangocon 2010
Pony Pwning Djangocon 2010
 

Último

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Writing an (in)secure webapp in 3 easy steps

  • 1. Writing an (in)secure webapp JSCONF 2011 // Adam Baldwin
  • 2. insecure webapps I lied - There are no “3 easy steps” Writing (in)secure Webapps // JSCONF // MAY 2011
  • 3. Introduction @adam_baldwin Co-Founder of nGenuity PenTester of webs Curator of evilpacket.net Writing (in)secure Webapps // JSCONF // MAY 2011
  • 4. Writing (in)secure Webapps // JSCONF // MAY 2011
  • 5. Stuff to talk about • Writing insecure apps • # Navigation • Output Encoding • Piles of other crap Writing (in)secure Webapps // JSCONF // MAY 2011
  • 6. Writing Insecure Writing (in)secure Webapps // JSCONF // MAY 2011
  • 7. Why is it so easy? • Resource constrained • Landscape always changing • Engineering vs innovation Writing (in)secure Webapps // JSCONF // MAY 2011
  • 8. #! navigation zomg Writing (in)secure Webapps // JSCONF // MAY 2011
  • 9. # navigation /#http://evilpacket.net/login CORS is awesome Writing (in)secure Webapps // JSCONF // MAY 2011
  • 10. Cross-Site Scripting fireblog.com Writing (in)secure Webapps // JSCONF // MAY 2011
  • 11. Context Matters It’s not okay to just encode “><‘& <img src=#{STUFF}/> <img src=a onerror=CODE/> Writing (in)secure Webapps // JSCONF // MAY 2011
  • 12. ESAPI / jquery-encoder $('#submit-entity-payload').click(function() {     var payload = $('#entity-payload').val();     $('#entity- container').html( $.encoder.encodeForHTML(payload) ); }); Writing (in)secure Webapps // JSCONF // MAY 2011
  • 13. Content Security Policy * Example 1: A server wants all content to come from its own domain: X-Content-Security-Policy: default-src 'self' Example 2: An auction site wants to allow images from anywhere, plugin content from a list of trusted media providers including a content distribution network, and scripts only from a server under its control hosting sanitized ECMAScript: X-Content-Security-Policy: default-src 'self'; img-src *; object-src media1.example.com *.cdn.example.com; script-src trustedscripts.example.com * Firefox 4 only Writing (in)secure Webapps // JSCONF // MAY 2011
  • 14. Other Crap That Matters • Cross-Site Request Forgery • Clickjacking (X-Frame-Options) • Cookies (HTTPOnly / Secure) • ... Writing (in)secure Webapps // JSCONF // MAY 2011
  • 16. References nGenuity: http://ngenuity-is.com Evilpacket: http://evilpacket.net JavaScript-based ESAPI: An In-Depth Overview: https://www.owasp.org/images/0/0b/ESAPI4JS-Marcus.Niemietz.pdf Content Security Policy: http://people.mozilla.com/~bsterne/content-security-policy/ jQuery Encoder: http://plugins.jquery.com/project/jqencoder http://software.digital-ritual.net/jqencoder/ Writing (in)secure Webapps // JSCONF // MAY 2011

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n