Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Computer Network Security. Use of diagrams is encouraged. You can sketch the att

ID: 3663118 • Letter: C

Question

Computer Network Security.

Use of diagrams is encouraged.

You can sketch the attack diagrams on a paper with descriptions and take a picture with your camera and submit alongside your typed contents. Diagrams don’t have to be perfect.

1. Describe in details Cross-Site Scripting (XSS) Servers side attack and how programmers and system designers can protect their servers from this type of attack .

2. Describe in details SQL Injection (XSS) Servers side attack and how programmers and system designers can protect their servers from this type of attack.

3. Describe in details Cross-Site Request Forgery attack client side attack and how individuals can protect themselves from becoming victims of this type of attack.

Explanation / Answer

1.Cross site scripting(xss)Is basically a client side code injection attack in which the attacker can execute the various malicious scripts into a legitimate website or a given web application.It usually occurs when a website makes an unvalidated use of user input within the output it generates.It explloits a vulnerability within a website as a means to deliver the malicious code to the victim's browser.

Example: the common search form looks like this on a web:

This search form looks something like this

For a given search performed on a website we have

Here by chance if an attacker tries to inject malicious script from this side.

Search for

If web application has nothing implemented to encode input and filter malicious scripts, it will take input as it is and then print on webpage where it will be called. So, at the keyword place, it will look like this:

It will be executed by the browser and it will display an alert box saying “XSS injection.” This shows how cross site scripting works and helps the attacker spread harmful files into the website easily by changing the html script.

It can be prevented by :

a)Contexual output encoding/ escapng of the string input:This is one of the primary defence against these types of attacks.

b)Validating the untrusted HTML input safely:The untrusted html must be passed through the html sanitization to ensure it does not contain any xss code. The sanitization process includes the basic tags for changing fonts are often allowed, such as <b>, <i>, <u>, <em>, and <strong> while more advanced tags such as <script>, <object>, <embed>, and <link> are removed by the sanitization process. Potentially dangerous attributes such as the onclick attribute are removed in order to prevent malicious code from being injected.

SQL INJECTION ATTACK:

This is basically a code injection attack in which the various the various sql statements are inserted by the attacker into an entry field for execution.The attacker exploits a security vulnerability example when the user input is incorrectly filtered for string literal escapt characters embedded in sql statments os the user input is not strong typed by the user itself and its executed unexpectedly.These attacks helps attackets to spoof identity and misuse the data to a great extent.

For example IN order to draw the various records from a given table or databse we have:

SQL injection occurs for a given value that returns true always

here 1=1 will always be true and instead of retrieving particular records all records of database will be displayed and the attacker can access them and misuse them.

The various ways to prevent sql injection are:

a)Use parameterized statements:Instead of embedding user input in a given statements we should use parameterized statements, Ove here a placeholder can only store a value of the given type and not an arbitrary SQL fragment. Hence the SQL injection would simply be treated as a strange or an invalid) parameter value preventing the access to the hacker.

b)Escape characters: One of the most important ways to prevent it is to use escape characters that have a special meaning in sql.Also every occurrence of a single quote (') in a parameter must be replaced by two single quotes ('') to form a valid SQL string literal.

example:

c) Checking the various patterns:Integer, float or boolean,string parameters can be checked if their value is valid representation for the given type. Strings that must follow some strict pattern (date, UUID, alphanumeric only, etc.) can be checked if they match this pattern.

CROSS SITE REQUEST FORGERY

This is a one click attack where the unauthorised commands are transmitted from a user which the website trusts. CSRF exploits the trust that a site has in a user's browser.Malicious requests are sent from a site that a user visits to another site that the attacker believes the victim is validated against.The malicious requests are routed to the target site via the victim’s browser, which is authenticated against the target site.

for example: I visit the sitehappen to visit malicious.com. It just so happens that this site is trying to attack people who bank with citibank.com and has set up a CSRF attack on its site. The attack will transfer $1,50000.00 to account number 123456789. Somewhere on somemalicioussite.com, attackers have added this line of code:

<iframe src="http://citibanbank.com/app/transferFunds?amount=150000&destinationAccount=... >

Upon loading that iframe, my browser will send that request to citibank.com, which my browser has already logged in as me. The request will be processed and send $1,50000.00 to account 123456789.

This is how the attacker gains access to the private details of the website and performs the attack in just one click within a simple iframe.

The various ways to prevent this attack are:

a)The most common method to prevent Cross-Site Request Forgery (CSRF) attacks is to append unpredictable challenge tokens to each request and associate them with the user’s session. Such tokens should at a minimum be unique per user session, but can also be unique per request. By including a challenge token with each request, the developer can ensure that the request is valid and not coming from a source other than the user.

b)Cookie to header token:

The token must be unique and unpredictable. It may be generated randomly, or it may be derived from the session token using HMAC:

c) Synchronizer token pattern: In this the token,secret and the unique value for each request is embedded and verified on the server side. The attacker is not able to place a unqiue token and is not able to perform activities.

example:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote