SlideShare a Scribd company logo
.NETSecurityTopics
XSS, SQL Injection, CSRF, ClickJacking, Secure File Handling,
Odds & Ends for .NET
 Cross-site Scripting (XSS)
 Definitions
 Examples
 Mitigation strategies
 Mitigation examples
Definitions
 Cross-site Scripting (XSS)
 Occurs when a web application gathers malicious data from a user
(untrusted source).The data is usually gathered in the form of a
hyperlink or form submission, database, or cookie which contains
malicious content within it.
 Malicious data is generally in the form of Javascript or HTML
 Types are DOM-based, “stored” (persistent) and “reflected” (non-
persistent)
Examples
 Cross-site Scripting (XSS)
 http://en.wikipedia.org/wiki/Cross_site_scripting#Exploit_scenarios
 <SCRIPT type="text/javascript"> var adr =
'../evil.php?cakemonster=' +
escape(document.cookie); </SCRIPT>
 <body onload=alert('test1')>
 <b onmouseover=alert('Wufff!')>click me!</b>
 <img src="http://url.to.file.which/not.exist"
onerror=alert(document.cookie);>
 <IMG SRC=j&#X41vascript:alert('test2')>
 <META HTTP-EQUIV="refresh"
CONTENT="0;url=data:text/html;base64,PHNjcml
wdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg">
Mitigations
 Cross-site Scripting (XSS)
 Explicitly set character set encoding (meta charset)
 Identify special characters
 Encode all dynamic output (htmleditformat)
 Filter special characters in dynamic elements (blacklist –
not preferable)
 Stronger data validation (whitelist/positive – preferable)
 Never count on client side validation (it can be turned
off)
 Use HttpOnly cookies
 Use secure cookies whenever possible
 No one thing will mitigate all threats, it will require use
of multiple techniques
XSS Defense
Code
 Show the code
 SQL Injection
 Definitions
 Examples
 Mitigation strategies
 Mitigation examples
Definitions
 SQL Injection (fromWikipedia)
 Technique often used to attack data driven applications by including
portions of SQL statements in an entry field in an attempt to get the
website to pass a newly formed rogue SQL command to the
database (e.g., dump the database contents to the attacker).
 The vulnerability happens when user input is either incorrectly
filtered for string literal escape characters embedded in SQL
statements or user input is not strongly typed and unexpectedly
executed.
 SQL injection is mostly known as an attack vector for websites but
can be used to attack any type of SQL database.
 In operational environments, it has been noted that applications
experience an average of 71 attempts an hour
Examples
 SQL Injection
 http://en.wikipedia.org/wiki/SQL_injection#Examples
 http://www.mydomain.com/products/products.asp?productid=123
or 1=1
 http://www.mydomain.com/products/products.asp?productid=123;
DROP
 TABLE Products
Mitigations
 SQL Injection
 Never trust input data.Validate everything
 Avoid dynamic SQL built with string concatenation
 Prefer stored procedures 0r ORM
 If dynamic SQL, used parameterized commands
 Sensitive/confidential data should be encrypted
 Limit connection privilege (no DBO or SA)
SQL Injection
Defense
Examples
 Show the code snips
 Cross-site Request Forgery (CSRF)
 Definition
 Examples
 Mitigation strategies
Definition
 Cross-site Request Forgery (CSRF)
 Attack which forces an end user to execute unwanted actions on a
web application in which he/she is currently authenticated.
 Embed HTML in malicious site that preys on users authenticated on
other sites.
 Submitting unauthorized data to your application from other servers
(untrusted)
 Not easy to make a successful attack, but that doesn’t mean we
shouldn’t protect ourselves
Examples
 Cross-site Request Forgery (CSRF)
 <img
src="http://bank.example/withdraw?account=bob&amount=1000000&for=ma
llory">
 Million-dollar dream home example
Mitigation
 General mitigation strategy
 Per request tokens (nonce) to url/form
 Referrer checking (less desirable – spoofing)
OtherGeneralPrinciplesThatApply
 Good practices
 Log detected exploit attempts and notify someone
 Lock out attacker
 Be careful about exposing error data, it can be extremely helpful to
an attacker
CSRF Defense  Show the code
ClickJacking
 OWASP Definition:
Clickjacking, also known as a "UI redress attack", is when an attacker
uses multiple transparent or opaque layers to trick a user into
clicking on a button or link on another page when they were
intending to click on the the top level page.Thus, the attacker is
"hijacking" clicks meant for their page and routing them to other
another page, most likely owned by another application, domain, or
both.
Using a similar technique, keystrokes can also be hijacked.With a
carefully crafted combination of stylesheets, iframes, and text
boxes, a user can be led to believe they are typing in the password
to their email or bank account, but are instead typing into an
invisible frame controlled by the attacker.
Examples
 For example, imagine an attacker who builds a web site that has a button on it
that says "click here for a free iPod". However, on top of that web page, the
attacker has loaded an iframe with your mail account, and lined up exactly the
"delete all messages" button directly on top of the "free iPod" button.The
victim tries to click on the "free iPod" button but instead actually clicked on
the invisible "delete all messages" button. In essence, the attacker has
"hijacked" the user's click, hence the name "Clickjacking".
 One of the most notorious examples of Clickjacking was an attack against the
Adobe Flash plugin settings page. By loading this page into an invisible
iframe, an attacker could trick a user into altering the security settings of
Flash, giving permission for any Flash animation to utilize the computer's
microphone and camera.
 Clickjacking also made the news in the form of aTwitter worm.This
clickjacking attack convinced users to click on a button which caused them to
re-tweet the location of the malicious page, and propagated massively.
 Recently, clickjacking attacks abusing Facebook's "Like" functionality has
grown significantly. Attackers can trick logged-in Facebook users to arbitrarily
like fan pages, links, groups, etc
Defenses –
Browser
 NoScript
Defenses –
Coding against
 Javascript code to make sure current frame is the top level window
(Ok, but not great, not going to show it)
 Browser response headers (Good, and will get better)
Response
Headers
 X-FRAME-OPTIONS
 Response header that newer browsers recognize, which controls
framing behavior
 https://www.owasp.org/index.php/Clickjacking#Defending_with_
response_headers
 Be sure to read the limitations, specifically the stuff about proxies,
and know that not all options are currently supported (ALLOW-
FROM only IE8+).
 Code example (ASP.NET).
ClickJacking
Resources
 https://www.owasp.org/index.php/Clickjacking
 http://en.wikipedia.org/wiki/Clickjacking
 http://nakedsecurity.sophos.com/2010/05/31/viral-clickjacking-
like-worm-hits-facebook-users/
 http://ha.ckers.org/blog/20081007/clickjacking-details/
 http://blogs.msdn.com/b/sdl/archive/2009/02/05/clickjacking-
defense-in-ie8.aspx
 http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combatin
g-clickjacking-with-x-frame-options.aspx
 http://www.enhanceie.com/test/clickjack/
ClickJacking
Defense
 Show the code
Secure File
Upload
Principles
 Whitelist what you accept
 Validate file format and other attributes
 Upload to safe location outside the webroot
Image Resizing  Show the code
Odds & Ends -
Tips
 Be careful in what you include in error messages that get thrown
to a browser
 Sanitize log input (don’t XSS your log database)
 Cigital SecureAssist plugin forVS.
 Visual Studio Code Analysis (general code quality issues)
Resources
 OWASP
 http://www.owasp.org/index.php/Cross-site_scripting
 http://www.owasp.org/index.php/Top_10_2007-A1
 http://www.owasp.org/index.php/SQL_Injection
 http://www.owasp.org/index.php/CSRF
 CERT
 http://www.cert.org/tech_tips/malicious_code_mitigation.html
 Wikipedia
 http://en.wikipedia.org/wiki/Cross_site_scripting
 http://en.wikipedia.org/wiki/SQL_injection
 http://en.wikipedia.org/wiki/Cross-site_request_forgery
 XSS Cheat Sheet
 http://ha.ckers.org/xss.html
 http://blog.stevensanderson.com/2008/09/01/prevent-cross-site-
request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-
helper/
 http://msdn.microsoft.com/en-us/magazine/hh708755.aspx
 http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-
syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-
mvc-2.aspx
Resources
 http://cheesewz.tumblr.com/post/87099308919/springpad-is-dead
 https://docs.google.com/spreadsheets/d/1CV4bQDpaGbXUSHdn
WwQUxzsu4fVdn2vzBWO72Y3Hk1s/edit?usp=sharing
 http://html5sec.org/
 http://blogs.microsoft.co.il/blogs/sasha/archive/2013/05/06/attacki
ng-web-applications.aspx
 https://www.sans.org/course/secure-coding-net-developing-
defensible-applications
 http://www.pluralsight.com/training/Courses

More Related Content

What's hot

Secure code practices
Secure code practicesSecure code practices
Secure code practices
Hina Rawal
 
Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2
Abhinav Sejpal
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security tools
Nico Penaredondo
 
Security asp.net application
Security asp.net applicationSecurity asp.net application
Security asp.net application
ZAIYAUL HAQUE
 
How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )
Katy Slemon
 
Browser Exploit Framework
Browser Exploit FrameworkBrowser Exploit Framework
Browser Exploit Framework
n|u - The Open Security Community
 
Web application security
Web application securityWeb application security
Web application security
Kapil Sharma
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
Nahidul Kibria
 
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
Samvel Gevorgyan
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
Michael Peters
 
React security vulnerabilities
React security vulnerabilitiesReact security vulnerabilities
React security vulnerabilities
AngelinaJasper
 
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
 
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
 
BEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYAN
BEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYANBEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYAN
BEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYAN
Samvel Gevorgyan
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
bilcorry
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
hruth
 
[Wroclaw #6] Introduction to desktop browser add-ons
[Wroclaw #6] Introduction to desktop browser add-ons[Wroclaw #6] Introduction to desktop browser add-ons
[Wroclaw #6] Introduction to desktop browser add-ons
OWASP
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
Cybersecurity Education and Research Centre
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
Neoito
 
Owasp webgoat
Owasp webgoatOwasp webgoat
Owasp webgoat
Zakaria SMAHI
 

What's hot (20)

Secure code practices
Secure code practicesSecure code practices
Secure code practices
 
Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security tools
 
Security asp.net application
Security asp.net applicationSecurity asp.net application
Security asp.net application
 
How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )How to Make Your NodeJS Application Secure (24 Best Security Tips )
How to Make Your NodeJS Application Secure (24 Best Security Tips )
 
Browser Exploit Framework
Browser Exploit FrameworkBrowser Exploit Framework
Browser Exploit Framework
 
Web application security
Web application securityWeb application security
Web application security
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 
React security vulnerabilities
React security vulnerabilitiesReact security vulnerabilities
React security vulnerabilities
 
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)
 
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
 
BEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYAN
BEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYANBEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYAN
BEST PRACTICES OF WEB APPLICATION SECURITY By SAMVEL GEVORGYAN
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 
[Wroclaw #6] Introduction to desktop browser add-ons
[Wroclaw #6] Introduction to desktop browser add-ons[Wroclaw #6] Introduction to desktop browser add-ons
[Wroclaw #6] Introduction to desktop browser add-ons
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
 
Owasp webgoat
Owasp webgoatOwasp webgoat
Owasp webgoat
 

Similar to .NET Security Topics

Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site ScriptingAli Mattash
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008
abhijitapatil
 
Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2
SURBHI SAROHA
 
Reflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
Rob Ragan
 
SQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web securitySQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web security
Moutasm Tamimi
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
Barrel Software
 
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSSWeb Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
Ivan Ortega
 
Xss attack
Xss attackXss attack
Xss attack
Manjushree Mashal
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
Amit Tyagi
 
Web-Security-Application.pptx
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptx
hamidTalib2
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
HallTumserFinalPaper
HallTumserFinalPaperHallTumserFinalPaper
HallTumserFinalPaper
Daniel Tumser
 
XSS Exploitation
XSS ExploitationXSS Exploitation
XSS Exploitation
Hacking Articles
 
Xss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEAXss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEA
Thuy_Dang
 
logout.php Session Data after Logout Username Email . $_.docx
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docx
smile790243
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
Xss 101
Xss 101Xss 101

Similar to .NET Security Topics (20)

SeanRobertsThesis
SeanRobertsThesisSeanRobertsThesis
SeanRobertsThesis
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008
 
Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2Web security landscape Unit 3 part 2
Web security landscape Unit 3 part 2
 
Methods Hackers Use
Methods Hackers UseMethods Hackers Use
Methods Hackers Use
 
Reflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
SQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web securitySQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web security
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSSWeb Security - OWASP - SQL injection & Cross Site Scripting XSS
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
 
Xss attack
Xss attackXss attack
Xss attack
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
 
Web-Security-Application.pptx
Web-Security-Application.pptxWeb-Security-Application.pptx
Web-Security-Application.pptx
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
 
HallTumserFinalPaper
HallTumserFinalPaperHallTumserFinalPaper
HallTumserFinalPaper
 
XSS Exploitation
XSS ExploitationXSS Exploitation
XSS Exploitation
 
Xss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEAXss.e xopresentation from eXo SEA
Xss.e xopresentation from eXo SEA
 
logout.php Session Data after Logout Username Email . $_.docx
logout.php Session Data after Logout  Username  Email  . $_.docxlogout.php Session Data after Logout  Username  Email  . $_.docx
logout.php Session Data after Logout Username Email . $_.docx
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
 
Xss 101
Xss 101Xss 101
Xss 101
 

Recently uploaded

GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 

.NET Security Topics

  • 1. .NETSecurityTopics XSS, SQL Injection, CSRF, ClickJacking, Secure File Handling, Odds & Ends for .NET
  • 2.  Cross-site Scripting (XSS)  Definitions  Examples  Mitigation strategies  Mitigation examples
  • 3. Definitions  Cross-site Scripting (XSS)  Occurs when a web application gathers malicious data from a user (untrusted source).The data is usually gathered in the form of a hyperlink or form submission, database, or cookie which contains malicious content within it.  Malicious data is generally in the form of Javascript or HTML  Types are DOM-based, “stored” (persistent) and “reflected” (non- persistent)
  • 4. Examples  Cross-site Scripting (XSS)  http://en.wikipedia.org/wiki/Cross_site_scripting#Exploit_scenarios  <SCRIPT type="text/javascript"> var adr = '../evil.php?cakemonster=' + escape(document.cookie); </SCRIPT>  <body onload=alert('test1')>  <b onmouseover=alert('Wufff!')>click me!</b>  <img src="http://url.to.file.which/not.exist" onerror=alert(document.cookie);>  <IMG SRC=j&#X41vascript:alert('test2')>  <META HTTP-EQUIV="refresh" CONTENT="0;url=data:text/html;base64,PHNjcml wdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg">
  • 5. Mitigations  Cross-site Scripting (XSS)  Explicitly set character set encoding (meta charset)  Identify special characters  Encode all dynamic output (htmleditformat)  Filter special characters in dynamic elements (blacklist – not preferable)  Stronger data validation (whitelist/positive – preferable)  Never count on client side validation (it can be turned off)  Use HttpOnly cookies  Use secure cookies whenever possible  No one thing will mitigate all threats, it will require use of multiple techniques
  • 7.  SQL Injection  Definitions  Examples  Mitigation strategies  Mitigation examples
  • 8. Definitions  SQL Injection (fromWikipedia)  Technique often used to attack data driven applications by including portions of SQL statements in an entry field in an attempt to get the website to pass a newly formed rogue SQL command to the database (e.g., dump the database contents to the attacker).  The vulnerability happens when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly executed.  SQL injection is mostly known as an attack vector for websites but can be used to attack any type of SQL database.  In operational environments, it has been noted that applications experience an average of 71 attempts an hour
  • 9. Examples  SQL Injection  http://en.wikipedia.org/wiki/SQL_injection#Examples  http://www.mydomain.com/products/products.asp?productid=123 or 1=1  http://www.mydomain.com/products/products.asp?productid=123; DROP  TABLE Products
  • 10. Mitigations  SQL Injection  Never trust input data.Validate everything  Avoid dynamic SQL built with string concatenation  Prefer stored procedures 0r ORM  If dynamic SQL, used parameterized commands  Sensitive/confidential data should be encrypted  Limit connection privilege (no DBO or SA)
  • 12.  Cross-site Request Forgery (CSRF)  Definition  Examples  Mitigation strategies
  • 13. Definition  Cross-site Request Forgery (CSRF)  Attack which forces an end user to execute unwanted actions on a web application in which he/she is currently authenticated.  Embed HTML in malicious site that preys on users authenticated on other sites.  Submitting unauthorized data to your application from other servers (untrusted)  Not easy to make a successful attack, but that doesn’t mean we shouldn’t protect ourselves
  • 14. Examples  Cross-site Request Forgery (CSRF)  <img src="http://bank.example/withdraw?account=bob&amount=1000000&for=ma llory">  Million-dollar dream home example
  • 15. Mitigation  General mitigation strategy  Per request tokens (nonce) to url/form  Referrer checking (less desirable – spoofing)
  • 16. OtherGeneralPrinciplesThatApply  Good practices  Log detected exploit attempts and notify someone  Lock out attacker  Be careful about exposing error data, it can be extremely helpful to an attacker
  • 17. CSRF Defense  Show the code
  • 18. ClickJacking  OWASP Definition: Clickjacking, also known as a "UI redress attack", is when an attacker uses multiple transparent or opaque layers to trick a user into clicking on a button or link on another page when they were intending to click on the the top level page.Thus, the attacker is "hijacking" clicks meant for their page and routing them to other another page, most likely owned by another application, domain, or both. Using a similar technique, keystrokes can also be hijacked.With a carefully crafted combination of stylesheets, iframes, and text boxes, a user can be led to believe they are typing in the password to their email or bank account, but are instead typing into an invisible frame controlled by the attacker.
  • 19. Examples  For example, imagine an attacker who builds a web site that has a button on it that says "click here for a free iPod". However, on top of that web page, the attacker has loaded an iframe with your mail account, and lined up exactly the "delete all messages" button directly on top of the "free iPod" button.The victim tries to click on the "free iPod" button but instead actually clicked on the invisible "delete all messages" button. In essence, the attacker has "hijacked" the user's click, hence the name "Clickjacking".  One of the most notorious examples of Clickjacking was an attack against the Adobe Flash plugin settings page. By loading this page into an invisible iframe, an attacker could trick a user into altering the security settings of Flash, giving permission for any Flash animation to utilize the computer's microphone and camera.  Clickjacking also made the news in the form of aTwitter worm.This clickjacking attack convinced users to click on a button which caused them to re-tweet the location of the malicious page, and propagated massively.  Recently, clickjacking attacks abusing Facebook's "Like" functionality has grown significantly. Attackers can trick logged-in Facebook users to arbitrarily like fan pages, links, groups, etc
  • 21. Defenses – Coding against  Javascript code to make sure current frame is the top level window (Ok, but not great, not going to show it)  Browser response headers (Good, and will get better)
  • 22. Response Headers  X-FRAME-OPTIONS  Response header that newer browsers recognize, which controls framing behavior  https://www.owasp.org/index.php/Clickjacking#Defending_with_ response_headers  Be sure to read the limitations, specifically the stuff about proxies, and know that not all options are currently supported (ALLOW- FROM only IE8+).  Code example (ASP.NET).
  • 23. ClickJacking Resources  https://www.owasp.org/index.php/Clickjacking  http://en.wikipedia.org/wiki/Clickjacking  http://nakedsecurity.sophos.com/2010/05/31/viral-clickjacking- like-worm-hits-facebook-users/  http://ha.ckers.org/blog/20081007/clickjacking-details/  http://blogs.msdn.com/b/sdl/archive/2009/02/05/clickjacking- defense-in-ie8.aspx  http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combatin g-clickjacking-with-x-frame-options.aspx  http://www.enhanceie.com/test/clickjack/
  • 25. Secure File Upload Principles  Whitelist what you accept  Validate file format and other attributes  Upload to safe location outside the webroot
  • 26. Image Resizing  Show the code
  • 27. Odds & Ends - Tips  Be careful in what you include in error messages that get thrown to a browser  Sanitize log input (don’t XSS your log database)  Cigital SecureAssist plugin forVS.  Visual Studio Code Analysis (general code quality issues)
  • 28. Resources  OWASP  http://www.owasp.org/index.php/Cross-site_scripting  http://www.owasp.org/index.php/Top_10_2007-A1  http://www.owasp.org/index.php/SQL_Injection  http://www.owasp.org/index.php/CSRF  CERT  http://www.cert.org/tech_tips/malicious_code_mitigation.html  Wikipedia  http://en.wikipedia.org/wiki/Cross_site_scripting  http://en.wikipedia.org/wiki/SQL_injection  http://en.wikipedia.org/wiki/Cross-site_request_forgery  XSS Cheat Sheet  http://ha.ckers.org/xss.html  http://blog.stevensanderson.com/2008/09/01/prevent-cross-site- request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken- helper/  http://msdn.microsoft.com/en-us/magazine/hh708755.aspx  http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt- syntax-for-html-encoding-output-in-asp-net-4-and-asp-net- mvc-2.aspx
  • 29. Resources  http://cheesewz.tumblr.com/post/87099308919/springpad-is-dead  https://docs.google.com/spreadsheets/d/1CV4bQDpaGbXUSHdn WwQUxzsu4fVdn2vzBWO72Y3Hk1s/edit?usp=sharing  http://html5sec.org/  http://blogs.microsoft.co.il/blogs/sasha/archive/2013/05/06/attacki ng-web-applications.aspx  https://www.sans.org/course/secure-coding-net-developing- defensible-applications  http://www.pluralsight.com/training/Courses

Editor's Notes

  1. I group these two topics because most of the mitigation actions are the same, though the threat itself is different.
  2. DOM-based rely on locally stored web pages. Stored attacks are stored in the database and retrieved in output to users. Reflected attacks are where the injected code is reflected off of the webserver, and usually delivered in an email (Phishing) or off of another server.
  3. Talk about the cheat sheet. Talk about the one from the PEN test. Examples may seem silly, but if you can popup an alert it can be a very deep rabbit hole
  4. <META http-equiv="Content-Type" content="text/html; charset=IS O-8859-1"> <META http-equiv="Content-Type" content="text/html; UTF-8">
  5. I group these two topics because most of the mitigation actions are the same, though the threat itself is different.
  6. DOM-based rely on locally stored web pages. Stored attacks are stored in the database and retrieved in output to users. Reflected attacks are where the injected code is reflected off of the webserver, and usually delivered in an email (Phishing) or off of another server.
  7. Talk about the cheat sheet. Talk about the one from the PEN test. Examples may seem silly, but if you can popup an alert it can be a very deep rabbit hole
  8. <META http-equiv="Content-Type" content="text/html; charset=IS O-8859-1"> <META http-equiv="Content-Type" content="text/html; UTF-8">
  9. XSS Cheat Sheet has tons of sample exploit code to test mitigations against.