Week 7 - Web Security and Malware Flashcards

Learn about security on the Internet and they type of attacks that occur on there. Includes SQL injection, Cross site scripting, malware taxonomy etc.

1
Q

What is a SQL injection attack?

A

When an attack users input maliciously to deploy SQL queries rather than an expected data input. This attack only words for application that use a sql database.

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

What could and attacker use an SQL injection to do?

A

They could ‘drop’ all tables or records in the database.
They could modify a record or multiple records.
They could select and display row data to themselves.
They could attempt to disrupt validation.

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

What is password spraying?

A

When an attacker refers to a list of common passwords to attempt to attack a large number of accounts. An attacker might use sql injection to disrupt validation so that instead of looking for and account with a certain username or password, the sql only looks for an account with the specified password. If the attacker uses the list of common passwords they will likely gain access to at least one account.

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

How do you do comments in SQL?

A

You use –

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

How would you inject mutple SQL statements at once?

A

You would use batch sql would allow you to execute mutple SQL statements by separating the statements with a ; or joining them using UNION. Separating with a ; typically doesn’t work as application do not normally deal with a second set of data return from a second sql statement.

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

Why might using ; to execute more sql statements to get a second set of data not work as compared to a UNION statement?

A

Separating with a ; typically doesn’t work as applications do not normally deal with a second set of data returned from a second sql statement, thus the second set of data will be dropped in favour of dealing with the first commands data.

A UNION statement on the other hand join statements together and allows for the data returned from those statements to be joined as one result table.

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

How might one prevent an SQL injection?

A

Prepared statements/parameterised queries

Stored procedures

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

What is a prepared statement?

A

It is a way of executing sql in Web application that allows the sql command and the parameters to be defined separately so that the application can tell what is code and what is not. The command is defined first and the parameters and passed in afterwards. This means that any parameter inouts will never be considered code and thus cannot inject sql.

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

How would you implement a prepared statement?

A

You would first get the parameters from the input data.
Next you would defined the sql command as a string, with a placeholder value that goes where parameters should go (in java this placeholder is ?).
Next you create a prepared statement object which let’s the application know that that the sql command string is a command, and convert it as such.
Finally we can pass in the input parameters to this prepared statement and it will add them in order to all the placeholders, knowing not to treat the parameters as sql code (In java we use the prepared statement method setString(…) to add the parameters).

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

What is a stored procedure?

A

Stored procedures are used to prevent sql injections by defining an SQL query and the parameters separately, and passing the parameters in later so that the application does not recognise parameters as code. This is very similar to prepared statements, but the difference is that stored procedures are defined in the database itself, not the application. The application must retrieve the stored procedure to use it.

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

What is the difference between a stored procedure and a prepared statement?

A

Stored procedures are defined and stored in the database rather than defined in the code of the application.

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

How would you implement a stored procedure?

A

First, you get the parameters from the I out data.
Next you retrieve the procedure from the database and stored it is as a stored procedure in the code (In java it is stored as a CallableStatement).
Next you pass the parameters and add them into the statement in order (in java CallableStatement has a method setString(…) for this purpose) .
Now execute the statement.

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

What is cross site scripting?

A

It’s when an attacker takes advantage of unsanitised inputs to embed client side scripting (Normally java script) into a legitimate website.

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

What are the dangers of cross site scripting?

A

Once the script has eebn embedded in the site, all users that view the page with that script will have the script be executed for them, and depending on the purpose of the script it could potentially cause harm.

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

Give an example of cross site scripting?

A

A website has an inout like a comment box. If the comment box input is not sanitised, then script (e.g. Java script) entered into the comment will be registered as code rather than text. This means that the comment entered will be executed for users who view the comment.

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

What are the 2 categories of cross site scripting?

A

Stored cross site scripting attack

Reflected cross site scripting attack

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

What happens during a stored cross site scripting attack?

A

An attacker inouts malicious script into a website.
The site stores this data on its servers, without sanitising the input.
When a user accesses this data, the script is executed because the script is registered as code rather than text.

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

What are some uses for cross site scripting?

A

To open an unsafe website for the user.
To download an unsafe file onto the users pc.
To send data from the users session back to the attacker.
To comment out the rest of the Web page.

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

What happens during a Reflected cross site scripting attack?

A

In this type of scripting attacker, the malicious script is not inputed into inout fields on a Web page but rather variables in the Web page url. If the variable is not sanitised, then the script can be executed. This type of attacker only affects the user who enters the script.

E.g. Url:
https://www.example.co.uk/index?variablename=Insert script here

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

How might an attacker weaponise a Reflected cross site scripting attack, when the script is only executed for the person how enters it?

A

The attacker could send the link to an end user with the script as part of it in a url variable. If the user clicks the link then the script is executed for them.
An attackwr might use a url shortener to hide the fact that script is in the url, or link is on an online forum where the link shows as a title rather than the url.

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

What methods could you use to prevent a cross site scripting attack?

A

Being careful about what untrusted inputs you are injecting into your html and Web page code and clearly define sections fo your code that will refer to untrusted inputs.

Encoding inputs before injecting the data into your Web page.

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

What does Encoding your inouts do?

A

It ensures that inputs are not executed, by making sure that are not recognised as script/code. It goes through the inout and encodes characters that might result in the inout being executed e.g. Html <> tags. These characters may be encoded, but when displayed as text on screen they show as the original character.

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

What is broken authentication?

A

When authentication is not implemented properly. A company might implement their own password and session management, but this may not adhere to good security protocols.

For example, if a user logs into their bank account from a public company and the session time out is ey to an hour, someone else might be able to use that public computer to access the account before the session times out.

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

What is sensitive data exposure?

A

It is when unauthorised access is gained to sensitive data, and this data is copied, retrieved or stolen etc..
This could happen in different ways, e.g. Sql injection attacks, or compromised data servers.

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

How should you mitigate sensitive data exposure?

A

Only store sensitive data which you need to carry out your service.

Ensure that there is appropriate security and effective authentication and authorisation on the data. You might use encryption or hashing.

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

What are XML external entities?

A

It is when you use XML within a Web application to retrieve external data from another source.

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

How to mitigate attacks that take advantage of XML external entities?

A

Using the latest version of JSON or something similar.

Upgrading older XML processors.

Disabling the processing of external entities.

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

How might an attacker take advantage of XML external entities?

A

A malicious url could be provided as the source of the external entities, and thus retrieving and evaluating this data could result in a security incident e.g. Remote request for access, DoS,, scanning if the Web app system…

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

What is security Misconfiguration?

A

When security controls and protocols are poorly implemented, inaccurately configured or left insecure, putting your data at risk.

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

What is an example of security Misconfiguration?

A

Poor password management - allowing users to choose weak passwords, or storing passwords in physical locations.

Default account management - using default names for usernames and passwords and not changing them e.g. Admin.

Lack of maintenance of software - not updating software such as antiviruses and or other software or hardware.

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

What is broken access control?

A

It is the failure to uphold proper authentication of users and authorisation of permissions. Broken access control can main that users could act outside of their intended permissions and do things they otherwise couldn’t do.

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

What are examples of broken access control?

A

Insecure direct object references

Missing function level access control

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

What is insecure direct object references?

A

When an object is directly referenced from the url as a url parameter. These are insecure because the user could change the data being retrieved to data they cannot access by changing the parameter data in the url. It allows users to bypass permissions and authorisations. It only works if improper authentication is in place that doesn’t check that the user should have access to the data.

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

How would you mitigate insecure direct object references?

A

Implementing better authentication,by checking whether or not a user should have access to the data being referenced.
This could be done with session variables that check which user is logged in, and check whether that user can access the data.

Another option is to remove direct object references from url, and use indirect object references using input fields. E.g. A drop down inout that shows the ONLY the data that the user can access.

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

What is missing function level access control?

A

When improper authentication is in place that allows a user to request functionality they don’t have access to and are given access because their authorisation is not checked. Authentication is only happening at the presentation level, not the function level.

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

How would you mitigate the vulnerability of missing function level access control?

A

By implementing better authorisation. This authorisation must be at function level, rather than presentation level.

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

What is insecure deserialisation?

A

When there is no validation for editing a serialised object, thus introducing insecurities when derialisation of that object occurs if the deserialisation process does not valid the object either.

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

What is serialisation?

A

When a piece of data is converted into a format that can be stored more efficiently. Normally into a string that can be stored easily.

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

What is deserialisation?

A

The reverse process of serialisation. When you convert data from its stored form back to its original form.

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

What is an example exploit of insecure deserialisation?

A

An attacker could change the deserialised object of someone’s account data, like a cookie, so that they could change the permissions of that account or change the user logged in to gain unauthorised access to data. When deserialisation occurs, the attacker is recognised as an authorised user by the object wasn’t validated for untrusted changes.

41
Q

What can we do to mitigate the vulnerabilities of insecure deserialisation?

A

Reduce the amount of deserialisation taking place.

Checking integrity of serialised objects before deserializing them using digital signatures.

Logging exceptions and failures for deserialization.

42
Q

What is a vulnerability of using premade components in a system?

A

If the component cotnians malicious data it could be used to enact malicious incidents on your organisation or system.

43
Q

What is a premade component?

A

A component of code e.g. Classes, a block of code, methods, libraries, that are premade and can be added to systems for use.

44
Q

What is the issue with having insufficient logging and monitoring of a system?

A

It could mean that you cannot identify incidents as they occur or even afterwards, and means you will have less data to understand what happened and how to mitigate it in future.

45
Q

How should you improve organsational logging and monitoring?

A

By implementing logging policies that must be followed throughout the organisation, laying out what data should be logged and when.

Using tools that help with monitoring your system, for example security information and event management systems (SIEMS) which make it easier to understand the data being logged by outputting it in dashboards, or intrusion detection and prevention systems (IDPS) that are focused on a organisations networks and Firewalls to find out security issues there etc.

46
Q

What is malware?

A

A malicious software that causes damage to the system which it has infected.

47
Q

What are some types of malware?

A

Virus
Worm
Trojan horse

48
Q

Can malware affect hardware or just software?

A

It can affect both.

49
Q

Can different viruses attack different kinds of OSs?

A

Yes, malware can be OS specific.

50
Q

What is a virus?

A

A malicious executable that attaches itself to a host. The virus is executed when the host is interacted with. The virus’s purpose is to spread to as many computers as possible.

51
Q

What is a host in terms of a virus?

A

A batch file
An executable file
A macro with an excel file

52
Q

What is a mutating virus?

A

A virus that mutants itself by changing part of itself before it copies itself to another host. This many many different hosts will have that virus, but slightly different versions. When it mutates, the viruses signature changes, which makes it harder to combat against.

53
Q

What is a virus signature?

A

An identifier that is attributed to a virus and can be used to identify it if it is on a system.

54
Q

How can a antiviruses software combat against viruses?

A

By having a dictionary of virus signatures, which is full of known virus signatures. It can then identify known viruses infecting the computer.

55
Q

How might a virus make itself harder to detect?

A

Encrypting itself

Mutating itself

56
Q

Does a virus infect the same host twice?

A

No, the virus will check if the host is infected. If it is then it moves on, if it is not then it infects the computer and leaves its signature there so that if the virus comes back to the computer it will know it is already infected.

57
Q

What are the 3 components of the anatomy of a virus?

A

Concealment - trying to hide itself
Propagation - trying to spread itself
Signature - the virus identifier

58
Q

What are the 3 main parts of the code of the virus?

A

There is code relating the the concealment of the virus.
The payload of the virus.
The code to propagate itself across many hosts.

59
Q

What are the 2 types of triggers for viruses?

A

Time bombs

Logic bombs

60
Q

What is a time bomb virus?

A

A virus that triggers at a specific date/time specified in the virus code.

61
Q

What is a logic bomb virus?

A

A virus that triggers when a specific event occurs. E.g. A user logs into their account, they run a certain application etc..

62
Q

What are some infection classifications of viruses?

A
File infection
Boot sector infection
OS infection
Macro infection
Email infection
63
Q

TRUE OR FALSE: Viruses can be classified into different sub types of malware.

A

TRUE
A virus can be further classified depending on the actions its payload is taking e.g. If the payload encrypts the comouters data, it is a ransomware virus.

64
Q

What are some types of viruses?

A

Ransomware

Spyware

65
Q

What is a Worm?

A

A Worm is a piece of malware that spreads extremely fast until it causes damage to a system/network with the number of copies and the amount of resources it has taken up with its propagation.

Note: Not all worms are created with malicious intent, but can become malicious if they spread too fast and get out of control of the creator.

66
Q

What is the difference between a Worm and a virus?

A

A Worm does not attach itself to a host file, whereas a virus does.
A Worm can propagate without user interactions, whereas a virus can only spread if the user has interacted with its host file.

67
Q

What is considered the first Internet Worm.

A

The Morris Worm.

Created by Robert Tappan Morris, with the purpose to count the number of computers on a network. He did not properly implement the Worm Propagation and it ended up overloading the network and causing a DoS.

68
Q

How does a Worm propagate?

A

It can use SSH to travel between comouters of a network assuming the SSH isn’t secure in its password or authorisation.

Bugs and issues in networks can be exploited to slip between the computers.

Vulnerabilities in OS can also be exploited.

It can also spread through instant messaging too.

69
Q

What is a Trojan horse sofware?

A

A piece of malware that disguises itself as a legitimate sofyware/application to seem non-threatening. It presents itself as a useful program and delivers on that useful service, but also has hidden malicious code that executes when you use the legitimate program.

Note: this can commonly introduce what is referred to as a backdoor.

70
Q

What is a backdoor?

A

A way for an attacker to gain access to the system and bypass security for the system.

71
Q

What is a Trojan horse common malware type?

A

Spyware, so that it can take data from the computer and send it back to the attacker with the guise of still being a legitimate program. It take son this more passive type of attack so that it is less likely to be discovered.

72
Q

What are the 3 approaches that an antiviruses can take?

A

Dictionary approach
Activity monitor approach
Integrity checker approach

73
Q

What is the dictionary approach for antiviruses?

A

In this approach the antivirus software stores and refers to a dictionary of known signatures for viruses/malware. It scans the system looking for any of the signatures in the database as this would be an instance of that virus.

If it finds one, then it will notify the user and take actions against the virus. It normally does this through quarantining the file.

74
Q

What is the activity monitor approach for antiviruses?

A

In the approach the antivirus looks at the behaviour of the system overall and monitors the activities of a system. If it thinks an activity occuribg on the system is malicious then it can take action. It might notice things like if a program is taking longer than normal to run.

Once it notices strange behaviour like this, it can ntofiy the user and quarantine the source.

75
Q

What is the integrity checker approach for antiviruses?

A

Sometimes known as the ‘behaviour blocker’ approach. In this approach the antivirus software monitors files for changes that are unusual e.g. A very old file that suddenly becomes much larger in size. Instances of unlikely behaviour can be notified to the end user, and the antivirus can then quarantine the file.

76
Q

What is quarantining in reference to an anitivirus software?

A

When an antivirus software takes a file it knows to be malware and removes it from the systems operations so it cannot execute. It can be done in many ways, one of these includes setting up a VM that is referred to as a sandbox that is disconnected from the system and put the file in there.
Note: Once a file has been quarantined, the antivirus can monitor its behaviour in a safe environment (Sandbox) to see if it is malware, and if so what was it trying to do.

77
Q

What are the disadvantages of the dictionary approach?

A

Antivirus software must be kept up to date so that the dictionary is updated with new virus signatures.

Its unlikely to catch new virus that have not been discovered and added to the dictionary.

It can also have challenges with polymorphic mutating viruses, whose signatures change when they mutate.

78
Q

What are the disadvantages with the integrity checker approach?

A

The anitivirus is reactive, and must first wait for some malicious behaviour to happen before it takes action.

79
Q

How can we detect viruses that are unknown i.e. Never been discovered before?

A

When vrisues are generated from the same software, they might have common structure and similarities that can be identified by an antivirus.

We also look to researchers whose job it is to identify new viruses. They look for instances of entirely new malware in the ‘wild’, and try to get a copy of it to analyse (Find out its purpose) , disassembling (Look at its inner structure) and identify (Give it an identifier and let antivirus software know about it) within an isolated environment.

80
Q

Why might disassembling a virus help to identify it?

A

It helps us see the inner structure and code of the virus, and this can help us identify its original code and use in future to identify similar viruses.

81
Q

What does a researcher do when trying to analyse a piece of malware?

A

They are trying to identify its purpose as a virus. They will split it into the separate components of the virus e.g. Split it into propagation, concealment and the payload. From this point they can look for a signature to identify the virus.

82
Q

What can an antivirus do after identifying a piece of malware and after quarantine has occurred?

A

It could disenffect it. It attempts to remove the virus from the infected host file in an attempt to keep the file intact. This isn’t always successful.

It can completely remove the virus. It removes the virus and the host from the system, this can sometimes be difficult as a virus may attempt to prevent this from happening.

83
Q

What is an IOC?

A

An indicator of compromise is an indicator that suggests the presence of malware or the occurrence of a secutiry incident or intrusion. This could be an event on the system, a certain behaviour or a file.

These can be used to identify future incidents, by notifying the system whenever previously identified IOCs occur.

84
Q

What are the 3 types of malware analysis?

A

Static
Dynamic
Hybrid of both

85
Q

What is static malware analysis?

A

Static analysis looks at the code and structure of the suspected malware without actually executing it. It looks at the file names, hashes, file header data, domains and such to identify whether it is malicious.

It can be used to identify malicious infrastructure, libraries and packed files.

86
Q

What is dynamic malware analysis?

A

In dynamic analysis the suspected malicious code is executed within an isolated safe sandbox environment. This allows the system to observe the behaviour of the malware and identify its purpose without risking a security incident.

87
Q

What is hybrid malware analysis?

A

A combitons of static and dynamic analysis. It analysis the structure and internal code of the malware and runs it in a sandbox, meaning it can dig deeper into the malware by implementing both techniques.

88
Q

What is the disadvantage of static analysis?

A

Since it doesn’t actually run the code, sophisticated malware and malicious runtime behaviour can go undetected. Meaning that not all malware can be identified by this analysis.

89
Q

What is the disadvantage of dynamic analysis?

A

Attackers are getting smarter, and since they know about the existence of sandboxes, they can code the malware to detect sandboxes.this means that some malware may be coded with hidden executables that remain dormant even when the main code is run, and only run when certain conditions are met. This can mean that the true nature of the malware might not be identified if the hidden code cannot be observed.

90
Q

What is the advantage to using a hybrid analysis approach?

A

It means that you get the best of both static and dynamic, withiut the disadvantages. Runtime behaviours can be noticed when running the code during dynamic analysis, while hidden code that will not execute with the main payload can be identified during static analysis.

91
Q

What do incident response teams do?

A

They provide root cause analysis of an incident, determine its impact on the system and attempt remediation and recovery after the attacker.

92
Q

What do threat hunters do?

A

They use behavior known to be malicious, and monitor the system for that behaviour or activity similar to it e.g. Access to a particular port or network that shouldn’t be connected to.

93
Q

What are the common steps of malware analysis?

A

Static property analysis
Interactive behaviour analysis
Fully automated analysis
Manual code reversing

94
Q

What is static property analysis?

A

The analysis and identification of the properties of the malware, such as embedded resources, file header details, hashes and so on. These are used to created initial IOCs and determine whether deeper analysis must take place.

95
Q

What is interactive behaviour analysis?

A

Analysis used to oberseve and interact with the malware sample running in a lab. The behaviour of the malware is monitored, such as its interaction with the network, howbeit uses memory, its fuke system etc.. This process is time consuming and requires a skilled analyst.

96
Q

What is fully automated analysis?

A

Quick and easy analysis that runs without the need of an analyst. It assesses the malware and determines the repercussions of it and the damage it could cause ofln the network. It then produces and easy to read report for the security teams.

This is the best type of analysis for processing malware at larger scales.

97
Q

What is manual code reversing?

A

.

98
Q

What is a tarpit?

A

A security mechanism used to slow done network connections to a server. It is used to delay attacks such as DoS attacks and worms. It slows done the Worm infection and delays DoS attacks.

99
Q

What is a a honeypot?

A

A decoy computer on the server that is set up to look like a legitimate computer on the network. It stores no valuable data and it is made to look enticing to attacks and malware. Once it is infected, the affects of the malware cna be observed on the computer and information can be gathered on it.