SlideShare a Scribd company logo
1 of 59
Download to read offline
CNIT 129S: Securing
Web Applications
Ch 1: Web Application (In)security
Updated 1-19-21
Web Applications
• E-commerce, Social networks, Online
banking, etc
.

• Fundamental security problem
:

• Users can supply arbitrary inpu
t

• Malicious input can compromise the site
Static Website: Web 1.0
• Information
fl
ows 

one-wa
y

• Users don't log in, 

shop, or submit comment
s

• An attacker who exploits
fl
aws in the Web
server software ca
n

• Steal data on the Web server (usually
only public data anyway
)

• Deface the site
Modern Web App
• Two-way 

information
fl
o
w

• Users log in, 

submit conten
t

• Content dynamically generated and tailored for
each use
r

• Much data is sensitive and private (e.g.
passwords
)

• Most apps developed in-hous
e

• Developers often naive about security
Common Web App
Functions
• Shopping (Amazon)
 

• Social networking (Facebook)
 

• Banking (Citibank)
 

• Web search (Google)
 

• Auctions (eBay)
 

• Gambling (Betfair)
 

• Web logs (Blogger)
 

• Web mail (Gmail)
 

• Interactive information (Wikipedia)
Internal Web Apps


("Cloud" Services)
• HR -- payroll information, performance review
s

• Admin interfaces to servers, VMs, workstation
s

• Collaboration software (SharePoint
)

• Enterprise Resource Planning (ERP
)

• Email web interfaces (Outlook Web Access
)

• Of
fi
ce apps (Google Apps, MS Of
fi
ce Live)
Bene
fi
ts of Web Apps
• HTTP is lightweight and connectionles
s

• Resilient in event of communications error
s

• Can be proxied and tunneled over other
protocol
s

• Web browsers run on many devices, highly
functional, easy to us
e

• Many platforms and development tools available
Web App Security
• Breaches are commo
n

• Attackers gets sensitive data, possibly
complete control of back-end system
s

• Denial of Service at Application Level
This Site is Secure
• A frequent claim, very far from the truth
100%
Secure
Online
Voting
• Link Ch 1b
Study by Text Authors
SinVR Hack
• Unauthenticated request allows anyone to download
PII from users


• Link Ch 1f
PII
• Link Ch 1c
• Link Ch 1d
The Core Security Problem
• Users can submit arbitrary inpu
t

• Alter parameters, cookies, HTTP header
s

• Client-side controls can't be truste
d

• Developers must assume all input is
maliciou
s

• Attackers have attack tools like Burp; they are
not restricted to using browsers
Possible Attacks
• Change the price of an ite
m

• Modify a session token to enter another user's
accoun
t

• Remove parameters to exploit logic
fl
aw
s

• SQL injectio
n

• SSL doesn't stop any of these
Key Problem Factors
• Underdeveloped security awarenes
s

• Custom developmen
t

• Deceptive simplicit
y

• Easy to make a website, but hard to secure i
t

• Rapidly evolving threat pro
fi
l
e

• Resource and time constraint
s

• Overextended technologie
s

• Increasing demands on functionality
The New Security Perimeter
• Edge
fi
rewalls and "bastion hosts" are no longer
enoug
h

• Keeping the attacker out of critical system
s

• Customers can now send transactions to servers
holding private dat
a

• Via the Web ap
p

• Web app must act as a security barrie
r

• Often it includes components from others, like
widget
s

• Errors by other companies can compromise your
servers
• Attackers can attack users instead of server
s

• XSS, drive-by downloads, etc
.

• E-mail used for password recover
y

• A compromised email account exposes many
other services also
The New Security Perimeter
The Future
• Some vulnerabilities
are decreasin
g

• #1 security
measure:
UPDATE
S

• Logic
fl
aws and
failure to use
controls properly are
not decreasin
g

• Link Ch 1e
Ch 1
CNIT 129S: Securing
Web Applications
Ch 2: Core Defense Mechanisms
Core Defense Elements
• Limiting user access to app's data and
functionalit
y

• Limiting user input to prevent exploits that use
malformed inpu
t

• Frustrating attackers with appropriate behavior
when targete
d

• Administrative monitoring and con
fi
guring the
application
Handling User Access
• Authenticatio
n

• Session managemen
t

• Access Control
Authentication
• Username and password is most common
metho
d

• Better: additional credentials and multistage
logi
n

• Best: client certi
fi
cates, smart cards, challenge-
response token
s

• Also: self-registration, account recovery,
password change
Common Login Problems
• Predictable username
s

• Password that can be guesse
d

• Defects in logic
Session Management
• Session: a set of data structures that track the
state of the use
r

• A token identi
fi
es the session, usually a cooki
e

• Can also use hidden form
fi
elds or the URL
query strin
g

• Sessions expire
Common Session Problems
• Tokens are predictable (not random
)

• Tokens poorly handled, so an attacker can
capture another user's token
Access Control
• Each request must be permitted or denie
d

• Multiple roles within applicatio
n

• Frequent logic errors and
fl
awed assumptions
Handling User Input
• "Input Validation" is the most common solution
Types of Input
• Arbitrary text, like blog post
s

• Cookie
s

• Hidden form
fi
eld
s

• Parameter
s

• HTTP header
fi
elds, like User-Agent
"Reject Known Bad"
• Also called "blacklisting
"

• Least effective metho
d

• Dif
fi
cult to identify all bad inputs
"Accept Known Good"
• Also called "whitelisting
"

• Most effective technique, where feasibl
e

• However, sometimes you can't do i
t

• Human names really contain apostrophes, so
you can't
fi
lter them out
Sanitization
• Render dangerous input harmles
s

• HTML-Encoding: Space becomes %20, etc
.

• Dif
fi
cult if several kinds of data may be present
within an item of inpu
t

• Boundary validation is better (four slides
ahead)
Safe Data Handling
• Write code that can't be fooled by malicious
dat
a

• SQL parameterized querie
s

• Don't pass user input to an OS command lin
e

• Effective when it can be applied
Semantic Checks
• Some malicious input is identical to valid inpu
t

• Such as changing an account number to
another customer's number
 

• Data must be validated in contex
t

• Does this account number being to the
currently logged-in user?
Dif
fi
culties with Simple Input
Validation
• Data coming from user is "bad" or "untrusted
"

• The server-side app is "good" and truste
d

• Many different types of input with different
fi
ltering
requirement
s

• Apps may chain several processing steps togethe
r

• Data may be harmless at one stage, but be
transformed into harmful data at another stage
Boundary Validation
• Trust boundar
y

• Divides a trusted zone from an untrusted zon
e

• Clean data that passes a boundar
y

• Such as from the user into an application
Boundary Validation
• Each component treats its input as potentially
maliciou
s

• Data validation performed at each trust
boundar
y

• Not just between client and server
Example
Example SOAP Request
• Link Ch 2a
• 1. App gets login: username and passwor
d

• Allows only good characters, limits length,
removes known attack signature
s

• 2. App performs a SQL query to verify
credential
s

• Escape dangerous characters
Boundary Validation Example
Boundary Validation Example
• 3. Login succeeds; app passes data from user
pro
fi
le to a SOAP servic
e

• XML metacharacters are encoded to block
SOAP injectio
n

• 4. App displays user's account information back
to the user's browse
r

• User-supplied data is HTML-encoded to block
XSS
Filtering Problems
• App removes this string
:

• <script
>

• So attacker sends thi
s

• <scr<script>ipt>
Multistep Validation
• App
fi
rst removes
 

../


• Then remove
s

..


• Attacker send
s

..../
Canonicalization
• App gets URL-encoded data from Web browse
r

• Apostrophe is %2
7

• Percent is %2
5

• To block apostrophes, app
fi
lters %2
7

• But URL is decoded twice by mistak
e

• %2527 becomes %27 becomes apostrophe
Handling Attackers
• Handling error
s

• Maintaining audit log
s

• Alerting administrator
s

• Reacting to attacks
Handling Errors
• Show appropriate error message
s

• Unhandled errors lead to overly-informative
error messages like this
Audit Logs
• Authentication events: login success and
failure, change of passwor
d

• Key transactions, such as credit card payment
s

• Access attempts that are blocked by access
control mechanism
s

• Requests containing known attack string
s

• For high security, log every client request in full
Protecting Logs
• Logs should contain time, IP addresses, and
usernam
e

• May contain cookies and other sensitive dat
a

• Attackers will try to erase and/or read log
s

• Log must be protecte
d

• Place on an autonomous system that only
accepts update message
s

• Flush logs to write-once media
Alerting Administrators
• Usage anomalies, like a large number of
requests from the same IP address or use
r

• Business anomalies, such as a large number of
funds transfers to/from the same accoun
t

• Requests containing known attack string
s

• Requests where hidden data has been modi
fi
ed
Firewalls
• Web App Firewalls can detect generic attack
s

• But not subtle ones that are speci
fi
c to your
ap
p

• Most effective security control is integrated with
app's input validation mechanism
s

• Check for valid values of your parameters
Reacting to Attacks
• Attackers probe for vulnerabilitie
s

• Sending many similar request
s

• Automated defense
s

• Respond increasingly slowly to request
s

• Terminate the attacker's session
Managing the Application
• Management interface allows administrator to
control user accounts, roles, access monitoring,
auditing, etc.
Attacking the Administration
Panel
• Defeat weak authenticatio
n

• Some administrative functions might not require
high privilege
s

• XSS
fl
aws can allow cookie theft and session
hijacking
Ch 2

More Related Content

What's hot

OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)TzahiArabov
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Brian Huff
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...Lenur Dzhemiliev
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOWASP Delhi
 
Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...Codemotion
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Moataz Kamel
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Amit Tyagi
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySandip Chaudhari
 
Learn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAPLearn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAPPaul Ionescu
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practicesScott Hurrey
 
Hacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdfHacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdfMatt Tesauro
 
Secure code
Secure codeSecure code
Secure codeddeogun
 
OWASP API Security Top 10 - API World
OWASP API Security Top 10 - API WorldOWASP API Security Top 10 - API World
OWASP API Security Top 10 - API World42Crunch
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Hossam .M Hamed
 
A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...Noppadol Songsakaew
 

What's hot (20)

Broken access controls
Broken access controlsBroken access controls
Broken access controls
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilities
 
Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
 
PHP Security
PHP SecurityPHP Security
PHP Security
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
 
Learn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAPLearn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAP
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
Hacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdfHacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdf
 
Secure code
Secure codeSecure code
Secure code
 
OWASP API Security Top 10 - API World
OWASP API Security Top 10 - API WorldOWASP API Security Top 10 - API World
OWASP API Security Top 10 - API World
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop
 
A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...
 

Similar to Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms

Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense MechanismsCh 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense MechanismsSam Bowne
 
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2Sam Bowne
 
Ch 6: Attacking Authentication
Ch 6: Attacking AuthenticationCh 6: Attacking Authentication
Ch 6: Attacking AuthenticationSam Bowne
 
CNIT 129S: 11: Attacking Application Logic
CNIT 129S: 11: Attacking Application LogicCNIT 129S: 11: Attacking Application Logic
CNIT 129S: 11: Attacking Application LogicSam Bowne
 
CNIT 129S Ch 7: Attacking Session Management
CNIT 129S Ch 7: Attacking Session ManagementCNIT 129S Ch 7: Attacking Session Management
CNIT 129S Ch 7: Attacking Session ManagementSam Bowne
 
CNIT 129: 6. Attacking Authentication
CNIT 129: 6. Attacking AuthenticationCNIT 129: 6. Attacking Authentication
CNIT 129: 6. Attacking AuthenticationSam Bowne
 
Ch 7: Attacking Session Management
Ch 7: Attacking Session ManagementCh 7: Attacking Session Management
Ch 7: Attacking Session ManagementSam Bowne
 
CNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking AuthenticationCNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking AuthenticationSam Bowne
 
Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Sam Bowne
 
CNIT 129S - Ch 6a: Attacking Authentication
CNIT 129S - Ch 6a: Attacking AuthenticationCNIT 129S - Ch 6a: Attacking Authentication
CNIT 129S - Ch 6a: Attacking AuthenticationSam Bowne
 
Complete Guide to Setup Secure Scheme for Restful APIs
Complete Guide to Setup Secure Scheme for Restful APIsComplete Guide to Setup Secure Scheme for Restful APIs
Complete Guide to Setup Secure Scheme for Restful APIsXing (Xingheng) Wang
 
Web authentication
Web authenticationWeb authentication
Web authenticationPradeep J V
 
CNIT 129S Ch 4: Mapping the Application
CNIT 129S Ch 4: Mapping the ApplicationCNIT 129S Ch 4: Mapping the Application
CNIT 129S Ch 4: Mapping the ApplicationSam Bowne
 
E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)
E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)
E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)Shandy Aditya
 
Threats of Database in ECommerce
Threats of Database in ECommerceThreats of Database in ECommerce
Threats of Database in ECommerceMentalist Akram
 
Ch 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsCh 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsSam Bowne
 
Lock it Down: Access Control for IBM i
Lock it Down: Access Control for IBM iLock it Down: Access Control for IBM i
Lock it Down: Access Control for IBM iPrecisely
 

Similar to Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms (20)

Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense MechanismsCh 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
 
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2
 
Ch 6: Attacking Authentication
Ch 6: Attacking AuthenticationCh 6: Attacking Authentication
Ch 6: Attacking Authentication
 
CNIT 129S: 11: Attacking Application Logic
CNIT 129S: 11: Attacking Application LogicCNIT 129S: 11: Attacking Application Logic
CNIT 129S: 11: Attacking Application Logic
 
CNIT 129S Ch 7: Attacking Session Management
CNIT 129S Ch 7: Attacking Session ManagementCNIT 129S Ch 7: Attacking Session Management
CNIT 129S Ch 7: Attacking Session Management
 
CNIT 129: 6. Attacking Authentication
CNIT 129: 6. Attacking AuthenticationCNIT 129: 6. Attacking Authentication
CNIT 129: 6. Attacking Authentication
 
Ch 7: Attacking Session Management
Ch 7: Attacking Session ManagementCh 7: Attacking Session Management
Ch 7: Attacking Session Management
 
CNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking AuthenticationCNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking Authentication
 
Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)
 
CNIT 129S - Ch 6a: Attacking Authentication
CNIT 129S - Ch 6a: Attacking AuthenticationCNIT 129S - Ch 6a: Attacking Authentication
CNIT 129S - Ch 6a: Attacking Authentication
 
Complete Guide to Setup Secure Scheme for Restful APIs
Complete Guide to Setup Secure Scheme for Restful APIsComplete Guide to Setup Secure Scheme for Restful APIs
Complete Guide to Setup Secure Scheme for Restful APIs
 
Web authentication
Web authenticationWeb authentication
Web authentication
 
CNIT 129S Ch 4: Mapping the Application
CNIT 129S Ch 4: Mapping the ApplicationCNIT 129S Ch 4: Mapping the Application
CNIT 129S Ch 4: Mapping the Application
 
E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)
E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)
E-Commerce Chap 5: E-COMMERCE SECURITY AND PAYMENT SYSTEMS (D3 B 2018)
 
Web security uploadv1
Web security uploadv1Web security uploadv1
Web security uploadv1
 
Cybercrime
CybercrimeCybercrime
Cybercrime
 
Threats
ThreatsThreats
Threats
 
Threats of Database in ECommerce
Threats of Database in ECommerceThreats of Database in ECommerce
Threats of Database in ECommerce
 
Ch 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsCh 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side Controls
 
Lock it Down: Access Control for IBM i
Lock it Down: Access Control for IBM iLock it Down: Access Control for IBM i
Lock it Down: Access Control for IBM i
 

More from Sam Bowne

3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities Sam Bowne
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development SecuritySam Bowne
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)Sam Bowne
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic CurvesSam Bowne
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-HellmanSam Bowne
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1Sam Bowne
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android ApplicationsSam Bowne
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)Sam Bowne
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3Sam Bowne
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard ProblemsSam Bowne
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)Sam Bowne
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis MethodologySam Bowne
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated EncryptionSam Bowne
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)Sam Bowne
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)Sam Bowne
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream CiphersSam Bowne
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data CollectionSam Bowne
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers Sam Bowne
 

More from Sam Bowne (20)

Cyberwar
CyberwarCyberwar
Cyberwar
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
 

Recently uploaded

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 

Recently uploaded (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 

Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms

  • 1. CNIT 129S: Securing Web Applications Ch 1: Web Application (In)security Updated 1-19-21
  • 2. Web Applications • E-commerce, Social networks, Online banking, etc . • Fundamental security problem : • Users can supply arbitrary inpu t • Malicious input can compromise the site
  • 3. Static Website: Web 1.0 • Information fl ows 
 one-wa y • Users don't log in, 
 shop, or submit comment s • An attacker who exploits fl aws in the Web server software ca n • Steal data on the Web server (usually only public data anyway ) • Deface the site
  • 4. Modern Web App • Two-way 
 information fl o w • Users log in, 
 submit conten t • Content dynamically generated and tailored for each use r • Much data is sensitive and private (e.g. passwords ) • Most apps developed in-hous e • Developers often naive about security
  • 5. Common Web App Functions • Shopping (Amazon) • Social networking (Facebook) • Banking (Citibank) • Web search (Google) • Auctions (eBay) • Gambling (Betfair) • Web logs (Blogger) • Web mail (Gmail) • Interactive information (Wikipedia)
  • 6. Internal Web Apps ("Cloud" Services) • HR -- payroll information, performance review s • Admin interfaces to servers, VMs, workstation s • Collaboration software (SharePoint ) • Enterprise Resource Planning (ERP ) • Email web interfaces (Outlook Web Access ) • Of fi ce apps (Google Apps, MS Of fi ce Live)
  • 7. Bene fi ts of Web Apps • HTTP is lightweight and connectionles s • Resilient in event of communications error s • Can be proxied and tunneled over other protocol s • Web browsers run on many devices, highly functional, easy to us e • Many platforms and development tools available
  • 8. Web App Security • Breaches are commo n • Attackers gets sensitive data, possibly complete control of back-end system s • Denial of Service at Application Level
  • 9. This Site is Secure • A frequent claim, very far from the truth
  • 11. Study by Text Authors
  • 12. SinVR Hack • Unauthenticated request allows anyone to download PII from users • Link Ch 1f
  • 13. PII
  • 14.
  • 17. The Core Security Problem • Users can submit arbitrary inpu t • Alter parameters, cookies, HTTP header s • Client-side controls can't be truste d • Developers must assume all input is maliciou s • Attackers have attack tools like Burp; they are not restricted to using browsers
  • 18. Possible Attacks • Change the price of an ite m • Modify a session token to enter another user's accoun t • Remove parameters to exploit logic fl aw s • SQL injectio n • SSL doesn't stop any of these
  • 19. Key Problem Factors • Underdeveloped security awarenes s • Custom developmen t • Deceptive simplicit y • Easy to make a website, but hard to secure i t • Rapidly evolving threat pro fi l e • Resource and time constraint s • Overextended technologie s • Increasing demands on functionality
  • 20. The New Security Perimeter • Edge fi rewalls and "bastion hosts" are no longer enoug h • Keeping the attacker out of critical system s • Customers can now send transactions to servers holding private dat a • Via the Web ap p • Web app must act as a security barrie r • Often it includes components from others, like widget s • Errors by other companies can compromise your servers
  • 21. • Attackers can attack users instead of server s • XSS, drive-by downloads, etc . • E-mail used for password recover y • A compromised email account exposes many other services also The New Security Perimeter
  • 22. The Future • Some vulnerabilities are decreasin g • #1 security measure: UPDATE S • Logic fl aws and failure to use controls properly are not decreasin g • Link Ch 1e
  • 23. Ch 1
  • 24. CNIT 129S: Securing Web Applications Ch 2: Core Defense Mechanisms
  • 25. Core Defense Elements • Limiting user access to app's data and functionalit y • Limiting user input to prevent exploits that use malformed inpu t • Frustrating attackers with appropriate behavior when targete d • Administrative monitoring and con fi guring the application
  • 26. Handling User Access • Authenticatio n • Session managemen t • Access Control
  • 27. Authentication • Username and password is most common metho d • Better: additional credentials and multistage logi n • Best: client certi fi cates, smart cards, challenge- response token s • Also: self-registration, account recovery, password change
  • 28.
  • 29. Common Login Problems • Predictable username s • Password that can be guesse d • Defects in logic
  • 30. Session Management • Session: a set of data structures that track the state of the use r • A token identi fi es the session, usually a cooki e • Can also use hidden form fi elds or the URL query strin g • Sessions expire
  • 31. Common Session Problems • Tokens are predictable (not random ) • Tokens poorly handled, so an attacker can capture another user's token
  • 32. Access Control • Each request must be permitted or denie d • Multiple roles within applicatio n • Frequent logic errors and fl awed assumptions
  • 33. Handling User Input • "Input Validation" is the most common solution
  • 34. Types of Input • Arbitrary text, like blog post s • Cookie s • Hidden form fi eld s • Parameter s • HTTP header fi elds, like User-Agent
  • 35. "Reject Known Bad" • Also called "blacklisting " • Least effective metho d • Dif fi cult to identify all bad inputs
  • 36. "Accept Known Good" • Also called "whitelisting " • Most effective technique, where feasibl e • However, sometimes you can't do i t • Human names really contain apostrophes, so you can't fi lter them out
  • 37. Sanitization • Render dangerous input harmles s • HTML-Encoding: Space becomes %20, etc . • Dif fi cult if several kinds of data may be present within an item of inpu t • Boundary validation is better (four slides ahead)
  • 38. Safe Data Handling • Write code that can't be fooled by malicious dat a • SQL parameterized querie s • Don't pass user input to an OS command lin e • Effective when it can be applied
  • 39. Semantic Checks • Some malicious input is identical to valid inpu t • Such as changing an account number to another customer's number • Data must be validated in contex t • Does this account number being to the currently logged-in user?
  • 40. Dif fi culties with Simple Input Validation • Data coming from user is "bad" or "untrusted " • The server-side app is "good" and truste d • Many different types of input with different fi ltering requirement s • Apps may chain several processing steps togethe r • Data may be harmless at one stage, but be transformed into harmful data at another stage
  • 41. Boundary Validation • Trust boundar y • Divides a trusted zone from an untrusted zon e • Clean data that passes a boundar y • Such as from the user into an application
  • 42. Boundary Validation • Each component treats its input as potentially maliciou s • Data validation performed at each trust boundar y • Not just between client and server
  • 45. • 1. App gets login: username and passwor d • Allows only good characters, limits length, removes known attack signature s • 2. App performs a SQL query to verify credential s • Escape dangerous characters Boundary Validation Example
  • 46. Boundary Validation Example • 3. Login succeeds; app passes data from user pro fi le to a SOAP servic e • XML metacharacters are encoded to block SOAP injectio n • 4. App displays user's account information back to the user's browse r • User-supplied data is HTML-encoded to block XSS
  • 47. Filtering Problems • App removes this string : • <script > • So attacker sends thi s • <scr<script>ipt>
  • 48. Multistep Validation • App fi rst removes ../ • Then remove s .. • Attacker send s ..../
  • 49. Canonicalization • App gets URL-encoded data from Web browse r • Apostrophe is %2 7 • Percent is %2 5 • To block apostrophes, app fi lters %2 7 • But URL is decoded twice by mistak e • %2527 becomes %27 becomes apostrophe
  • 50. Handling Attackers • Handling error s • Maintaining audit log s • Alerting administrator s • Reacting to attacks
  • 51. Handling Errors • Show appropriate error message s • Unhandled errors lead to overly-informative error messages like this
  • 52. Audit Logs • Authentication events: login success and failure, change of passwor d • Key transactions, such as credit card payment s • Access attempts that are blocked by access control mechanism s • Requests containing known attack string s • For high security, log every client request in full
  • 53. Protecting Logs • Logs should contain time, IP addresses, and usernam e • May contain cookies and other sensitive dat a • Attackers will try to erase and/or read log s • Log must be protecte d • Place on an autonomous system that only accepts update message s • Flush logs to write-once media
  • 54. Alerting Administrators • Usage anomalies, like a large number of requests from the same IP address or use r • Business anomalies, such as a large number of funds transfers to/from the same accoun t • Requests containing known attack string s • Requests where hidden data has been modi fi ed
  • 55. Firewalls • Web App Firewalls can detect generic attack s • But not subtle ones that are speci fi c to your ap p • Most effective security control is integrated with app's input validation mechanism s • Check for valid values of your parameters
  • 56. Reacting to Attacks • Attackers probe for vulnerabilitie s • Sending many similar request s • Automated defense s • Respond increasingly slowly to request s • Terminate the attacker's session
  • 57. Managing the Application • Management interface allows administrator to control user accounts, roles, access monitoring, auditing, etc.
  • 58. Attacking the Administration Panel • Defeat weak authenticatio n • Some administrative functions might not require high privilege s • XSS fl aws can allow cookie theft and session hijacking
  • 59. Ch 2