DauHoang WebSecurity Chapter 3 Web Security Measures PDF
DauHoang WebSecurity Chapter 3 Web Security Measures PDF
CHAPTER 3 – WEB
SECURITY MEASURES
TOPICS
2
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
3
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
4
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
5
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
6
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
7
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
8
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
9
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Rule: The more factor groups are used the higher level of
security the user authentication is.
❖ Question: how many factor groups are there in the user
authentication using email + password + OTP (One Time
Password sent by SMS)?
10
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
11
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
12
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
13
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
14
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Authentication process:
1. When the client browser requests a protected resource (a file or a
folder) on the web Server;
2. Receiving the access request, the web server sends required
authentication response (coded 401):
15
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Authentication process:
3. When browser receives required authentication response from the
server, it displays authentication dialogue box asking the user to
provide the username and password;
4. Having the username and password from user, browser:
a. creates the reply message by combining username and password in the
form of username:password;
b. Encode the reply message using base64 method;
c. Puts the message into authentication header and sends to web server.
16
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Authentication process:
5. Receiving authentication information from browser, the web server
verifies the provided username and password:
a. If the username and password are valid, allows the browser to Access the
requested resource;
b. If the username and password are NOT valid, returns an error or sends
the re-authentication response.
17
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Pros:
▪ Simple and easy to implement.
❖ Cons:
▪ Insecure password communication as base64 doesn’t ensure the
confidentiality and the encoded password can be decoded easily.
▪ Password is sent from browser to server frequently that may cause the
password leaking and stealing;
• This is because the server doesn’t have a session, hence browser usually
stores username and password and sends them to server on request.
▪ Insure storage of passwords:
• Username and password are stored and sent to server on request
automatically;
• No session exists, therefore user can’t sign out.
18
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
19
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
20
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
21
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
22
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
23
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
24
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
25
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
26
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
27
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
28
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
29
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
30
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
▪ Sever gets back the Token from Browser and it can distinguish
requests from each individual user.
31
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
32
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
33
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
34
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
35
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
36
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
Tokens (1) ASCII string (2) Hexa string (3) Subtraction of 2 adjacent
numbers (4)
37
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
38
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
39
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
40
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
41
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
42
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
43
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
44
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
45
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
46
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
47
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
48
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
49
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
50
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
51
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
52
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
53
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
54
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
55
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
56
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Measures:
▪ Need to warn the user about unusual activities on account / session;
▪ Session termination in reaction-style should be used for some
applications require a high level of security, such as banking
applications, which adds the ability to immediately terminate the
session when:
• Received an unusual request;
• There are signs of code insertion attacks;
▪ Require authentication at each query can help slow down all types of
attacks, ensuring security.
57
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
58
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
59
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
60
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
Default contents
61
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
62
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
63
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Apache Tomcat web servers provide a tool to read and modify session
parameters Attackers can exploit this tool to interfere the user sessions.
64
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
65
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
Directory browsing
66
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
Directory browsing
67
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
68
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
69
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
70
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
71
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
72
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
73
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
74
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
75
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
76
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
77
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
78
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
79
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
80
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
https://wahh-app.com/scripts/GetImage.aspx?file=..\..\windows\repair\sam
81
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
..\..\..\..\windows\system32\config\sam
../../../../etc/password
../../../../etc/shadow
82
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
83
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Defensive measures:
▪ Restrict / minimize the read/write operations to the local file system
based on input parameters from users;
▪ If the operations are necessary:
• Carefully validate input data to filter out all path traversal strings, such as
..\..\ or ../../ from the filename;
• Limit access to specific folders;
• Use standard or library filters that have been tested carefully.
84
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
85
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
▪ where %3f is the encoding of ‘?’ character that is the beginning of the
URL query string;
▪ The initial interpreter doesn’t perform URL decoding, but it considers
‘%3f.jsp’ as a script file and sends the filename to the JSP interpreter;
▪ The JSP interpreter converts %3f to ‘?’ and considers it as an invalid
request, causing a processing error that returns list of files in current
folder.
86
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
87
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
88
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
89
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
90
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
91
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
92
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
93
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
SQLi examples
94
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
95
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
96
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
97
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
Blind SQLi
❖ Blind SQLi to get information about system and database
98
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
99
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
100
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
101
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
102
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
103
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
104
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
105
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
106
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
107
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
108
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
109
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
https://admin4963.mysite.com
https://mysite.com/admin4963/
110
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
111
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
112
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
113
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ User Interface:
▪ Is the interface between user and browser
▪ User Interface consists of:
• Menu
• Address bar
• Tool bar (Home, Back, Forward, Refresh, Stop,…)
• Bookmarks or Favourites
• Tabs
114
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Browser Engine
▪ Is the intermediate component to process and transfer inputs from
User Interface to Rendering Engine.
❖ Rendering Engine:
▪ Responsible for displaying requested content to screen
▪ Processing flow:
• Parsing HTML tags;
• Use styles to build the presentation tree;
• Build presentation arrangements.
115
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Networking
▪ Responsible for making network service calls, such as sending HTTP
requests to web server and receiving responses from the web server.
❖ JavaScript Interpreter
▪ Responsible for interpreting and executing JavaScript code in web
page.
❖ UI Backend
▪ Responsible for drawing objects in the browser such as windows,
combo boxes, lists, ...
❖ Data Storage
▪ A local database on a browser is responsible for storing data for the
browser to operate: Cache, Cookies, History,...
116
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
117
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
118
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ ActiveX support
▪ ActiveX is supported by Microsoft Internet Explorer on Microsoft
Windows
▪ Many ActiveX components contains many security flaws, helping
hackers to attack the browser and the system.
❖ Java Support
▪ Allows to run Java programs through JVM as Applets in the sandbox
▪ If the JVM installation has security errors, the java code in the Applet
can help hackers attack the browser and the system.
119
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Plug-ins/Add-on/Extensions support:
▪ Browser plugins, ad-ons, or extensions:
• External modules are added to the browser
• Provide new features / utilities for users.
▪ Some common plug-ins: Adobe Flash Player, Adobe (Acrobat)
Reader, Java plugin, ActiveX, ...
▪ Plug-ins and extensions also pose many security risks to the browser
• Add attack interfaces;
• Some malicious code is written in the form of plug-ins.
120
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Cookies
▪ May contain personal data and many other information
▪ Cookies can be stolen through XSS attacks, etc.
❖ JavaScript
▪ Help websites increase interactivity
▪ Facilitates the XSS code execution.
❖ VBScript
▪ This feature is similar to JavaScript, but only supported on Microsoft
Internet Explorer.
121
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
122
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
123
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
124
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
125
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
Web of Trust
126
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
LongURL.org
127
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
❖ Evaluation criteria:
▪ Update frequency
▪ Number of vulnerabilities discovered / exploited
▪ Sandbox feature
▪ Ability to block malicious code using social engineering
128
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
129
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
130
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
131
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
132
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
133
WEB SECURITY LECTURE NOTES
CHAPTER 3 – WEB SECURITY MEASURES
134