SlideShare a Scribd company logo
Issues with Origins
Web App Vulnerabilities
by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
What is it?
Issues with origins occur when
CORS headers grant access to an
application’s resources by external
parties. Alternatively, a missing
CSP header could allow external
sources being loaded in an
application.
What causes it?
Bad configuration of the CORS and CSP
headers. The CORS header can be set
too broadly by specifying a wildcard,
allowing all external origins. A missing
CSP header will not restrict sources that
can be loaded in the application.What could happen?
A private API or other application
sources could be exposed to all
external sources. Content injections
could result in cross-site scripting or
injection of other malicious content
in the application.
How to prevent it?
Set the CSP and CORS headers with
appropriate configuration, limiting
sources that can be loaded in the
application and sources that can be
loaded by external parties.
Issues with Origins
Understanding SOP
What is SOP?
The Same Origin Policy (SOP) is a
security mechanism that isolates
sources from different origins. An
origin is defined as the
combination of {protocol, host,
port}. As a result, scripts
executed on one site will not be
able to access certain resources
from another site, such as
cookies for example.
URL Outcome Reason
http://www.example.com/dir/profile.html True Same
protocol,
host, port.
http://www.example.com/dir2/user.html True Same
protocol,
host, port.
http://www.example.com:81/dir/profile.html False Different
port.
https://www.example.com/dir/profile.html False Different
protocol.
http://example.com/dir/profile.html False Different
host.
SOP in practice.
Let’s see whether the following URLs are
considered to be the same origin as an
example URL:
http://www.example.com/dir/home.html
Issues with Origins
Understanding CSP
What is CSP?
The Content Security Policy (CSP)
header allows an application to
define origins of content that are
allowed to load on its page, such
as JavaScript, HTML frames, and
applets. A well-configured CSP
header can prevent cross-site
scripting, clickjacking, and other
content injections on the web
page.
CSP in practice.
CSP has directives for every type of
resource, some examples:
script-src : Defines which scripts can be
executed.
form-action : List valid endpoints for
form submissions.
child-src : Defines allowed contents for
embedded frames.
object-src : Limits where Flash and other
plugins can be loaded from.
By default, if a directive is missing, it is assumed to allow everything.
This can be overwritten for most directives by specifying a “default-src”.
Issues with Origins
Understanding CORS
What is CORS?
Cross-origin Resource Sharing is
a standard consisting of headers
that allow to overwrite SOP and
make resources, such as APIs
available to other origins. CORS
request headers are automatically
set when making a call to a
server, after which the server
replies with response headers.
CORS in practice.
The following CORS response headers are
the most important ones.
Access-Control-Allow-Origin: Specifies a
URI that may access the resource.
Access-Control-Allow-Methods: Specifies
the allowed methods when accessing a
resource.
Issues with Origins
Understanding the security vulnerability
Welcome,
Admin!
Overly lax CSP
The site makes use of a CSP
header to protect against XSS. It
does not allow any scripts.
However, by default, the child-src
directive is set wide open.
Content-Security-Policy:
script-src ‘none’
A popular news site has
drawn attention from an
attacker, who tries to find
vulnerabilities in the site.
Latest News:
Internet
hacked again.
The attacker has been able to inject a
hidden malicious iframe on the news
site that tries to install malware on
the users’ PCs.
Latest News:
Internet
hacked again.
<iframe>malicious.com</iframe>
Because of a badly
configured CSP
header, the iframe is
loaded when a user
views the news article.
Latest News:
Internet
hacked again.
Issues with Origins
Understanding the security vulnerability API privacy issues
An application offers a
private API that should
only be available
internally.
a.app.com
b.app.com
GET
/resource/
private-
info
[Private
XML Data]
Because of an error, a CORS header
is set with a wildcard, thereby
allowing public access.
Access-Control-Allow-Origin: *
An attacker has found the API and
starts sending requests to it.
GET /resource/private-info
The attacker is able
to retrieve sensitive
data that should not
be publicly available.
<?xml version="1.0"
encoding="ISO-8859-1"?>
<users>
<user>
<uname>admin</uname>
<fname>Jane</fname>
<lname>Doe</lname>
</user>
<user>
<uname>jdoe</uname>
<fname>John</fname>
<lname>Doe</lname>
</user>
</users>[Private
XML Data]
Issues with Origins
Realizing the impact
A private API could accidentally be made
public, resulting in loss of private
information or revenue.
Script injection in an application could endanger
users and cause reputational damage.
Without proper access control an external
party might be able to modify resources.
Issues with Origins
Preventing the mistake
Content Security Policy
Determine which resources should be able to run.
Explicitly specify resources for every page.
Set a default-src.
Cross-origin Resource Sharing
Determine whether resources need to be available to other
origins.
Avoid configuring too broadly.
i.e. allowing public access by specifying wildcards.

More Related Content

What's hot (20)

PDF
Common Web Application Attacks
Ahmed Sherif
 
PPTX
Secure Code Warrior - Os command injection
Secure Code Warrior
 
PPTX
Secure Code Warrior - Local file inclusion
Secure Code Warrior
 
PPTX
Application Security Vulnerabilities: OWASP Top 10 -2007
Vaibhav Gupta
 
PPTX
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
PPT
Web Application Security
Chris Hillman
 
PPTX
Web application attack Presentation
Khoa Nguyen
 
PDF
Broken access controls
Akansha Kesharwani
 
PPTX
Web Security Attacks
Sajid Hasan
 
PPTX
A10 - Unvalidated Redirects and Forwards
Shane Stanley
 
PPTX
Secure Code Warrior - Secure by default
Secure Code Warrior
 
PPTX
Secure Code Warrior - Trust no input
Secure Code Warrior
 
PPTX
A7 Missing Function Level Access Control
stevil1224
 
PDF
Deltecs Services for Vulnerability Assessment and penetration testing
divyeshkharade
 
PPTX
SSRF exploit the trust relationship
n|u - The Open Security Community
 
PPTX
OWASP
gehad hamdy
 
PPT
Hacking A Web Site And Secure Web Server Techniques Used
Siddharth Bhattacharya
 
PPTX
Vulnerabilities in modern web applications
Niyas Nazar
 
PDF
Api security-testing
n|u - The Open Security Community
 
Common Web Application Attacks
Ahmed Sherif
 
Secure Code Warrior - Os command injection
Secure Code Warrior
 
Secure Code Warrior - Local file inclusion
Secure Code Warrior
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Vaibhav Gupta
 
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
Web Application Security
Chris Hillman
 
Web application attack Presentation
Khoa Nguyen
 
Broken access controls
Akansha Kesharwani
 
Web Security Attacks
Sajid Hasan
 
A10 - Unvalidated Redirects and Forwards
Shane Stanley
 
Secure Code Warrior - Secure by default
Secure Code Warrior
 
Secure Code Warrior - Trust no input
Secure Code Warrior
 
A7 Missing Function Level Access Control
stevil1224
 
Deltecs Services for Vulnerability Assessment and penetration testing
divyeshkharade
 
SSRF exploit the trust relationship
n|u - The Open Security Community
 
Hacking A Web Site And Secure Web Server Techniques Used
Siddharth Bhattacharya
 
Vulnerabilities in modern web applications
Niyas Nazar
 
Api security-testing
n|u - The Open Security Community
 

Viewers also liked (9)

PPTX
Secure Code Warrior - Client side injection
Secure Code Warrior
 
PPTX
Secure Code Warrior - Robust error checking
Secure Code Warrior
 
PPTX
Secure Code Warrior - Insufficient data encoding
Secure Code Warrior
 
PPTX
Secure Code Warrior - XQuery injection
Secure Code Warrior
 
PPTX
Secure Code Warrior - Privacy
Secure Code Warrior
 
PPTX
Secure Code Warrior - Defense in depth
Secure Code Warrior
 
PPTX
Secure Code Warrior - Logging
Secure Code Warrior
 
PPTX
Secure Code Warrior - Least privilege
Secure Code Warrior
 
PPTX
Secure Code Warrior - Fail securely
Secure Code Warrior
 
Secure Code Warrior - Client side injection
Secure Code Warrior
 
Secure Code Warrior - Robust error checking
Secure Code Warrior
 
Secure Code Warrior - Insufficient data encoding
Secure Code Warrior
 
Secure Code Warrior - XQuery injection
Secure Code Warrior
 
Secure Code Warrior - Privacy
Secure Code Warrior
 
Secure Code Warrior - Defense in depth
Secure Code Warrior
 
Secure Code Warrior - Logging
Secure Code Warrior
 
Secure Code Warrior - Least privilege
Secure Code Warrior
 
Secure Code Warrior - Fail securely
Secure Code Warrior
 
Ad

Similar to Secure Code Warrior - Issues with origins (20)

PPTX
Of CORS thats a thing how CORS in the cloud still kills security
John Varghese
 
PDF
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
haskgeilyn
 
PDF
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
dirosochaniz
 
PDF
Web Security - CSP & Web Cryptography
Samsung Open Source Group
 
PPT
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
PPTX
Conquering CORS. Taming Cross-Origin Resource Sharing.
Tony Nazarov
 
PPTX
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Divyanshu
 
PPTX
08- pen-testing Web applications attacks.pptx
wassimahmad9
 
PPTX
W3 conf hill-html5-security-realities
Brad Hill
 
PDF
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
ODP
Web Browser Basics, Tips & Tricks Draft 17
msz
 
PDF
Web Application Security 101
Cybersecurity Education and Research Centre
 
PDF
Web 13 | REST API
Mohammad Imam Hossain
 
PPTX
Getting started with dotnet core Web APIs
Knoldus Inc.
 
PDF
Essential Security Practices for Modern Web Developers.pdf
Zinavo Pvt Ltd
 
PPTX
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
annalakshmi35
 
PPTX
Automatically detecting security vulnerabilities in WordPress
Fresh Consulting
 
ODP
Web Browser Basics, Tips & Tricks - Draft 20 (Revised 5/18/17)
msz
 
PPTX
Browser Security ppt.pptx
AjaySahre
 
Of CORS thats a thing how CORS in the cloud still kills security
John Varghese
 
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
haskgeilyn
 
Web Application Security 2nd Edition (Early Release) Andrew Hoffman
dirosochaniz
 
Web Security - CSP & Web Cryptography
Samsung Open Source Group
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
Conquering CORS. Taming Cross-Origin Resource Sharing.
Tony Nazarov
 
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Divyanshu
 
08- pen-testing Web applications attacks.pptx
wassimahmad9
 
W3 conf hill-html5-security-realities
Brad Hill
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
Web Browser Basics, Tips & Tricks Draft 17
msz
 
Web Application Security 101
Cybersecurity Education and Research Centre
 
Web 13 | REST API
Mohammad Imam Hossain
 
Getting started with dotnet core Web APIs
Knoldus Inc.
 
Essential Security Practices for Modern Web Developers.pdf
Zinavo Pvt Ltd
 
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
annalakshmi35
 
Automatically detecting security vulnerabilities in WordPress
Fresh Consulting
 
Web Browser Basics, Tips & Tricks - Draft 20 (Revised 5/18/17)
msz
 
Browser Security ppt.pptx
AjaySahre
 
Ad

Recently uploaded (20)

PPTX
Q2 Leading a Tableau User Group - Onboarding
lward7
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Q2 Leading a Tableau User Group - Onboarding
lward7
 
July Patch Tuesday
Ivanti
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 

Secure Code Warrior - Issues with origins

  • 1. Issues with Origins Web App Vulnerabilities by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
  • 2. What is it? Issues with origins occur when CORS headers grant access to an application’s resources by external parties. Alternatively, a missing CSP header could allow external sources being loaded in an application. What causes it? Bad configuration of the CORS and CSP headers. The CORS header can be set too broadly by specifying a wildcard, allowing all external origins. A missing CSP header will not restrict sources that can be loaded in the application.What could happen? A private API or other application sources could be exposed to all external sources. Content injections could result in cross-site scripting or injection of other malicious content in the application. How to prevent it? Set the CSP and CORS headers with appropriate configuration, limiting sources that can be loaded in the application and sources that can be loaded by external parties.
  • 3. Issues with Origins Understanding SOP What is SOP? The Same Origin Policy (SOP) is a security mechanism that isolates sources from different origins. An origin is defined as the combination of {protocol, host, port}. As a result, scripts executed on one site will not be able to access certain resources from another site, such as cookies for example. URL Outcome Reason http://www.example.com/dir/profile.html True Same protocol, host, port. http://www.example.com/dir2/user.html True Same protocol, host, port. http://www.example.com:81/dir/profile.html False Different port. https://www.example.com/dir/profile.html False Different protocol. http://example.com/dir/profile.html False Different host. SOP in practice. Let’s see whether the following URLs are considered to be the same origin as an example URL: http://www.example.com/dir/home.html
  • 4. Issues with Origins Understanding CSP What is CSP? The Content Security Policy (CSP) header allows an application to define origins of content that are allowed to load on its page, such as JavaScript, HTML frames, and applets. A well-configured CSP header can prevent cross-site scripting, clickjacking, and other content injections on the web page. CSP in practice. CSP has directives for every type of resource, some examples: script-src : Defines which scripts can be executed. form-action : List valid endpoints for form submissions. child-src : Defines allowed contents for embedded frames. object-src : Limits where Flash and other plugins can be loaded from. By default, if a directive is missing, it is assumed to allow everything. This can be overwritten for most directives by specifying a “default-src”.
  • 5. Issues with Origins Understanding CORS What is CORS? Cross-origin Resource Sharing is a standard consisting of headers that allow to overwrite SOP and make resources, such as APIs available to other origins. CORS request headers are automatically set when making a call to a server, after which the server replies with response headers. CORS in practice. The following CORS response headers are the most important ones. Access-Control-Allow-Origin: Specifies a URI that may access the resource. Access-Control-Allow-Methods: Specifies the allowed methods when accessing a resource.
  • 6. Issues with Origins Understanding the security vulnerability Welcome, Admin! Overly lax CSP The site makes use of a CSP header to protect against XSS. It does not allow any scripts. However, by default, the child-src directive is set wide open. Content-Security-Policy: script-src ‘none’ A popular news site has drawn attention from an attacker, who tries to find vulnerabilities in the site. Latest News: Internet hacked again. The attacker has been able to inject a hidden malicious iframe on the news site that tries to install malware on the users’ PCs. Latest News: Internet hacked again. <iframe>malicious.com</iframe> Because of a badly configured CSP header, the iframe is loaded when a user views the news article. Latest News: Internet hacked again.
  • 7. Issues with Origins Understanding the security vulnerability API privacy issues An application offers a private API that should only be available internally. a.app.com b.app.com GET /resource/ private- info [Private XML Data] Because of an error, a CORS header is set with a wildcard, thereby allowing public access. Access-Control-Allow-Origin: * An attacker has found the API and starts sending requests to it. GET /resource/private-info The attacker is able to retrieve sensitive data that should not be publicly available. <?xml version="1.0" encoding="ISO-8859-1"?> <users> <user> <uname>admin</uname> <fname>Jane</fname> <lname>Doe</lname> </user> <user> <uname>jdoe</uname> <fname>John</fname> <lname>Doe</lname> </user> </users>[Private XML Data]
  • 8. Issues with Origins Realizing the impact A private API could accidentally be made public, resulting in loss of private information or revenue. Script injection in an application could endanger users and cause reputational damage. Without proper access control an external party might be able to modify resources.
  • 9. Issues with Origins Preventing the mistake Content Security Policy Determine which resources should be able to run. Explicitly specify resources for every page. Set a default-src. Cross-origin Resource Sharing Determine whether resources need to be available to other origins. Avoid configuring too broadly. i.e. allowing public access by specifying wildcards.