Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 01bcf1e

Browse files
committedMay 22, 2021
csrf
1 parent 0df5952 commit 01bcf1e

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed
 

‎Web-Issues-And-Monitoring/ApplicationSecurity.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,26 @@
1010
- attacker uses XSS to send malicious script to an unsuspected user.
1111
- harm
1212
- malicious scripts can access any cookies, session tokens, other sensitive information retained by browsers
13-
- scripts can rewrite the content of the html page
13+
- scripts can rewrite the content of the html page.
1414
- 3 types
1515
- Stored XSS - occurs when user input is stored in the db in form of comments, visitor log, message forum,
1616
victim is able to retrieve the stored data from the web application without the data being made safe to render.
17-
- Reflected XSS- occurs when user input is immediately returned by the app in error message, or in some other UI element
18-
- DOM based XSS - form of XSS where the source of the user data and target/sink of the user data never leaves the browser
17+
- Reflected XSS- occurs when user input is immediately returned by the app in error message, or in some other UI element.
18+
- DOM based XSS - form of XSS where the source of the user data and target/sink of the user data never leaves the browser.
19+
- how to prevent?
20+
- never insert untrusted data except in allowed locations
21+
- html encode before inserting untrusted/user data into html element
22+
- attribute encoding of dynamic html attributes
23+
- javascript encoding, css encoding
24+
- url encode before inserting data into html url parameters
25+
- use HttpOnly cookie flag (this flag mitigates risk of client side script accessing the cookie)
26+
- implement content security policy (browser side mechanism to create allow lists of client side resources of web application)
27+
28+
**Cross Site Request Forgery (CSRF)**
29+
- what? forces the victim to execute attack on a web application in which they're authenticated. only work if the target is logged into the system.
30+
- how? through social engineering (such as sending link via email/chat), an attacker may trick the users of a web app into executing attacks.
31+
- harm - successful attack may force the victims to perform state changing requests like transferring funds and others.
32+
- how to prevent?
33+
- csrf tokens (per requests or per user session) -should be unique, random and secret.
34+
- csrf tokens should not be transmitted using cookies.
35+
- can be added through hidden fields, headers. Make sure the token is not included in server logs, browser histroy

0 commit comments

Comments
 (0)
Please sign in to comment.