Website Vulnerabilities Flashcards

1
Q

Clickjacking

A

Clickjacking attacks trick web users into performing an action they did not intend, typically by rendering an invisible page element on top of the action the user thinks they are performing. Clickjacking attacks wrap a page the user trusts in an iframe, then renders invisible elements on top of the frame.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What could a determined hacker do with a clickjacking attack?

A

• Harvest login credentials, by rendering a fake login box on top of the real one. • Trick users into turning on their web-cam or microphone, by rendering invisible elements over the Adobe Flash settings page. • Spread worms on social media sites like Twitter and MySpace. • Promote online scams by tricking people into clicking on things they otherwise would not. • Spread malware by diverting users to malicious download links.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Clickjacking protection

A

To ensure that your site doesn’t get used in a clickjacking attack, you need to make sure it cannot be wrapped in an iframe by a malicious site. This can be done by giving the browser instructions directly via HTTP headers, or in older browser by using client-side JavaScript (frame-killing).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Cross-site scripting (XSS)

A

XSS vulnerabilities permit a malicious user to execute arbitrary chunks of JavaScript when other users visit your site.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What could a determined hacker do when exploiting a XSS vulnerability?

A

XSS allows arbitrary execution of JavaScript code, so the damage that can be done by an attacker depends on the sensitivity of the data being handled by your site. Some of the things hackers have done by exploiting XSS: Spreading worms on social media sites. Facebook, Twitter and YouTube have all been successfully attacked in this way. Session hijacking. Malicious JavaScript may be able to send the session ID to a remote site under the hacker’s control, allowing the hacker to impersonate that user by hijacking a session in progress. Identity theft. If the user enters confidential information such as credit card numbers into a compromised website, these details can be stolen using malicious JavaScript. Denial of service attacks and website vandalism. Theft of sensitive data, like passwords. Financial fraud on banking sites.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To protect against stored XSS attacks

A

make sure any dynamic content coming from the data store cannot be used to inject JavaScript on a page. Whitelist Values If a particular dynamic data item can only take a handful of valid values, the best practice is to restrict the values in the data store, and have your rendering logic only permit known good values. For instance, instead of asking a user to type in their country of residence, have them select from a drop-down list. Implement a Content-Security Policy Modern browsers support Content-Security Policies that allow the author of a web-page to control where JavaScript (and other resources) can be loaded and executed from. XSS attacks rely on the attacker being able to run malicious scripts on a user’s web page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Reflected XSS attacks

A

Any page that takes a parameter from a GET or POST request and displays that parameter back to the user in some fashion is potentially at risk. A page that fails to treat query string parameters as untrusted content can allow the construction of malicious URLs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Reflected XSS vulnerabilities

A

Search results - does the search criteria get displayed back to the user? Is it written out in the page title? Are you sure it is being escaped properly? Error pages - if you have error messages that complain about invalid inputs, does the input get escaped properly when it is displayed back to the user? Does your 404 page mention the path being searched for? Form submissions - if a page POSdataTs , does any part of the data being submitted by the form get displayed back to the user? What if the form submission is rejected – does the error page allow injection of malicious code? Does an erroneously submitted form get pre-populated with the values previously submitted?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To protect against reflected XSS attacks

A

make sure that any dynamic content coming from the HTTP request cannot be used to inject JavaScript on a page. Also see XSS protection techniques

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Command Execution

A

Remote code execution is a major security lapse, and the last step along the road to complete system takeover. After gaining access, an attacker will attempt to escalate their privileges on the server, install malicious scripts, or make your server part of a botnet to be used at a later date. Command injection vulnerabilities often occur in older, legacy code, such as CGI scripts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Command Execution protection

A

Try to Avoid Command Line Calls Altogether Modern programming languages have interfaces that permit you to read files, send emails, and perform other operation system functions. Use APIs wherever possible – only use shell commands where absolutely necessary. This will reduce the number of attack vectors in your application, and will also simplify your codebase. Escape Inputs Correctly Injection vulnerabilities occur when untrusted input is not sanitized correctly. If you use shell commands, be sure to scrub input values for potentially malicious characters: ; & | ` Even better, restrict input by testing it against a regular expression of known safe characters. (For example, alphanumeric characters.) Restrict the Permitted Commands Try to construct all or most of your shell commands using string literals, rather than user input. Where user input is required, try to whitelist permitted values, or enumerate them in a conditional statement. Perform Thorough Code Reviews Check system calls for vulnerabilities as a part of your code review process. Vulnerabilities often creep in over time – make sure your team knows what to look for. Run with Restricted Permissions It is a good practice to run your server processes with only the permissions that they require to function – the principle of least privilege. This can help limit the impact of command injection vulnerabilities as a second line of defense. Make sure each web server process can only access the directories that it needs, and narrow down the directories in which they write or execute files. Consider running the process in a chroot jail if you are running on Unix. This will limit the ability of maliciously injected code to “climb out” of a directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

API

A

Application Programming Interface In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SQL injection

A

SQL injection is a type of injection attack. Injection attacks occur when maliciously crafted inputs are submitted by an attacker, causing an application to perform an unintended action. Because of the ubiquity of SQL databases, SQL injection is one of the most common types of attack on the internet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

SQL injection risks

A

Extract sensitive information, like Social Security numbers, or credit card details. Enumerate the authentication details of users registered on a website, so these logins can be used in attacks on other sites. Delete data or drop tables, corrupting the database, and making the website unusable. Inject further malicious code to be executed when users visit the site.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SQL protection

A

Parameterized Statements Programming languages talk to SQL databases using database drivers. A driver allows an application to construct and run SQL statements against a database, extracting and manipulating data as needed. Parameterized statements make sure that the parameters (i.e. inputs) passed into SQL statements are treated in a safe manner. Object Relational Mapping Many development teams prefer to use Object Relational Mapping (ORM) frameworks to make the translation of SQL result sets into code objects more seamless. ORM tools often mean developers will rarely have to write SQL statements in their code – and these tools thankfully use parameterized statements under the hood. The most well-known ORM is probably Ruby on Rails’ Active Record framework. Escaping Inputs Sanitizing Inputs Check that supplied fields like email addresses match a regular expression. Ensure that numeric or alphanumeric fields do not contain symbol characters. Reject (or strip) out whitespace and new line characters where they are not appropriate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

DOM-based XSS attacks

A

DOM-based XSS attacks have all the risks associated with the other types of XSS attack, with the added bonus that they are impossible to detect from the server side. Any page that uses URI fragments is potentially at risk from XSS attacks.

17
Q

Protecting against DOM-based XSS attacks

A

checking that your JavaScript does not interpret URI fragments in an unsafe manner. Use a JavaScript Framework Audit Your Code Carefully

18
Q

What is XSS

A

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted web sites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user within the output it generates without validating or encoding it. An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site. These scripts can even rewrite the content of the HTML page.

19
Q

XSS attack diagram

A
20
Q

Common coding errors

A

Copying data, wrong indexes in loops, and integer overflow are common coding mistakes to look out for in open source code and researchers advised programmers to check for portions of the code that are rarely executed as they are more prone to errors,

21
Q

More coding errors

A

strcpy without performing any check on the size of the copy

Wrong indexes in loops can result in more bytes being copied than was intended

Integer overflow bugs can often happen when attempting to avoid an excessive amount of data copying to a buffer.