CSC2031 Flashcards
How would you ensure data entered in a form is of the correct type?
Use appropriate form data fields.
How would you secure a password before storing it in a database?
Use hashing.
What could you do to prevent information leakage when something goes wrong in a web application.
Implement custom error pages.
Define Computer Security
Computer security is the protection of computer systems from theft or damage
What three things does computer security involve controlling?
Physical access to hardware, malpractice by users and network access, bad data, or code injection.
What are the three key properties of computer security
CIA Triad
Confidentiality
Integrity
Availability
Define Confidentiality
Data is kept private or restricted by ensuring only authorised users can access it.
When is confidentiality more important than other properties?
The value of the data depends on limiting access to it.
Examples: propriety data of a company, records of people’s personal activities, personal and financial information of a company’s customers
Define Integrity
Data is kept authentic, accurate and reliable by ensuring only authorised users can modify it.
When is integrity more important than other properties?
Data must be accurate and consistent.
Examples: financial records, exam results, medical records.
Define Availability
Data is kept available to authorised users when they need it.
When is availability more important than other properties?
Data must be sent or seen
Examples: urgent government press release, medical records, authentication data.
What are the two other security properties?
Authentication
Non-repudiation
Define Authentication
Determining whether someone or something is, in fact, who or what they claim to be.
Define Non-repudiation
Ensuring that someone or something cannot deny or contest something (The inability to refute responsibility).
What is the relationship between Threat, Vulnerability and Risk?
Risk = Threat x Vulnerability
Define Threat
A potential negative action or event that has the potential to harm a computer system.
Define Vulnerability
A weakness in a computer system that can be exploited by a threat to deliver a successful attack.
Define Risk
The potential (or chance) for loss or damage when a threat exploits a vulnerability.
Why does computer security matter?
Computer Systems are Valuable Targets
Computer Systems have many Security Threats
Cybercrime is Growing
Cybercrime Comes With a Cost
What are the main costs for victims or cybercrime
Economic Cost - Theft of IP, corporate information, disruption in trading, cost of repairing damaged systems.
Reputational Cost - Loss of consumer trust, loss of current and future customers to competitors, and poor media coverage.
Regulatory Cost - The General Data Protection Regulation (GDPR) and other data protection laws mean that organisations can suffer from large regulatory fines or sanctions as a result of cybercrimes.
Define Paradigm
A paradigm is defined as a pattern, model, approach, or distinct set of concepts or thought patterns
Define Programming Paradigm
A programming paradigm can simply be defined as a style of programming
A programming paradigm is a programming language. True or False?
False
A programming paradigm is enforced by the programming language compiler during the compilation stage. True or False?
True
What are the key programming paradigms?
Imperative Programming
Declarative Programming
What are the properties of Imperative programming?
A paradigm describing HOW the program should do something
Explicitly specify each step-by-step instruction (or statement), which change the program’s state.
Imperative programming is easier to reason about for beginners.
Example Languages: C, C++, Java, Python, Ruby
Usually has more lines of code.
Provides flexibility but brings in complexity
What are the properties of Declarative programming?
A paradigm describing WHAT the program does.
Does not explicitly specify each step-by-step instruction (overall control flow).
Allows more readable code to be written that reflects what exactly we want to see.
Example Languages: Prolog, Lisp, Haskell, Python (supports some declarative features)
Usually has less lines of code.
Hides complexity and provides simplicity.
What are some subsets of Imperative programming?
Structural programming
Procedural programming
Object-Oriented programming
What are some subsets of Declarative programming?
Functional programming
Logic programming
What are some other common programming paradigms?
Scripting
Event-Driven
Database Querying
What factors affect the adoption of a particular programming paradigm
Current system implementation
System requirements
Software availability and support
Programming knowledge
Processing power
Usability
Maintainability
Functionality
Familiarity
What are some common Data Types?
Text - single string, free text, email addresses, passwords, URLs
Numbers - digits, integers, floats, Booleans
Temporal - dates, times
Files - text, media, sound
Biometrics - face, fingerprint
What are some common Data Input Methods?
Command line interface
Data stores
Web pages
Internal devices
External devices
URLs
APIs
What is the major security challenge with dealing with data input?
Computer systems or applications can take lots of diverse data input, much of which may be unknown, untrusted or insecure; and may be malicious
Inputting malicious data into a system or application is a primary attack method; it can be difficult to detect a malicious user inputting such data.
Define Injection Attacks
With an injection attack, an attacker submits malicious input which then gets inserted or injected into a genuine query or command that is subsequently processed.
What are some negative impacts of injection attacks?
Data loss (broken confidentiality)
Data alterations (loss of integrity)
Denial of service (prevent availability)
Full system compromise
Define SQL injection Attack
An SQL injection attack consists of inputting malicious SQL code which is inserted or injected into genuine SQL commands of an SQL driven application to cause some negative or compromising action.
What can a successful SQL injection attack do?
Read sensitive data from a database
Modify database data (insert/update/delete).
Execute admin operations on the database, e.g. shutdown the Database Management System (DBMS).
Access a sensitive file on the DBMS file system.
Issue commands to the operating system.
Example of an SQL Injection Attack
User input: 105 or 1=1
SQL statement could be: SELECT * FROM Users WHERE userId = 105 or 1=1;
This is always TRUE, SQL query will return ALL rows from the Users table
Define Cross-Site Scripting (XSS) Attacks
Cross-Site Scripting (XSS) attacks involve injecting malicious scripts into vulnerable web applications which are subsequently delivered to and executed on users’ systems after they visit the website.
How a Cross-Site Scripting (XSS) attack works?
Malicious scripts are often written in JavaScript code.
The malicious script is included with dynamic content delivered as markup text (e.g. HTML) to a victim’s browser
XSS attacks take advantage of the fact that browsers cannot distinguish between legitimate and malicious markup but rather execute whatever markup they receive.
Rather than attacking a victim directly, an attacker can exploit a vulnerability in a web application by getting it to deliver the malicious script when users visit.
What can XSS attacks do?
With an XSS exploit, an attacker can steal a user’s session cookie and pretend to be that user.
Cookies can store a range of information including personal data.
XSS Attacks can also be used to spread malware, deface websites, disrupt social networks, phish for credentials, and cause more damaging attacks (with the addition of social engineering techniques).
Define Out of bounds read
Out of bounds read occurs when a program reads data past the end, or before the beginning, of an array or buffer.
Define Out of bounds write
Out of bounds write occurs when a program writes data past the end, or before the beginning, of an array or buffer.
What is bounds checking?
Bounds checking is a method of detecting whether a variable is within some bounds before it is used.
Commonly used to check that a variable used in an array is within the bounds of the array.
A failed bounds check usually generates some kind of exception signal.
Define Buffer Overflow Attack
A buffer overflow attack forces a program to put more data in an array/buffer than it can hold and therefore put the extra data in a memory area past a buffer.
What can a buffer overflow attack do?
Writing in an area of memory past the buffer can corrupt or overwrite the existing data, crash the program, or cause the execution of malicious code.
Why are some programming languages susceptible to a Buffer Overflow attack?
Certain languages such as C/C++ have no index checking.
It’s thought by some programmers to be time consuming, an overhead they don’t think is required.
What are format specifiers?
Format specifiers are used to take the next argument and print it in the specified format.
Define Format String Attacks
The Format String attack occurs when a submitted input String is evaluated as a command by the application to cause some malicious action.
Define Integer Overflow Attack
An integer overflow attack occurs when an integer values is forcibly incremented to a value that is too large to store in the associated representation and wraps around to become a very small or negative number.
Define Input Validation
Input validation is the proper checking or testing of any input supplied by a user or application to ensure it meets permitted input criteria.
How does input validation prevent invalid data entering a system?
Because it is difficult to detect a malicious user who is trying to attack software, applications should check and validate all input of a system to prevent security issues like injection and buffer overflow attacks.
Input validation should also occur when data is received from an external party, especially if the data is from untrusted sources.
Although not a guaranteed defence, input validation can considerably lower the impact of an input-based attack.
Define Whitelisting
Whitelisting defines allowed input data while any other input data is denied by default.
Define Blacklisting
Blacklisting defines unallowed input data while any other input data is allowed by default.
It is usually preferable to Blacklist data. True or False?
False, more mistakes occur with blacklisting as ALL unallowed inputs must be known.
Where are the 2 key places to place input validation?
It can be done client-side with HTML, handled with pure JavaScript or a specialist JavaScript library such as Jquery.
It could be done server-side within view functions, form validators, or using a server filter.
What is a data field?
Data fields can be used to validate input data as the type we want when implementing web forms.
Sample Data Fields
StringField()
EmailField()
IntegerField()
PasswordField()
DecimalField()
BooleanField()
Define CSRF Token
A CSRF Token is a random, unguessable string used to validate the origin of a request
What is a Cross-Site Request Forgery (CSRF) attack?
Tricking an authenticated user into sending a malicious request not generated via the application’s user interface is called a Cross- Site Request Forgery (CSRF) attack
Define Secret Key
A web application’s secret key is used for encryption tasks such as cryptographically signing session cookies and generating a CSRF token.
What is a validator?
Validator class instances can be added to a Form class to check or validate input data values.
Define Regular Expression (regex)
A regular expression is a String of text that defines the patterns or sequences that must be found within input data Strings to validate them (i.e., a search pattern).
Define Metacharacters
Metacharacters are special characters that affect how the Regex around them is interpreted.
What is a lookahead?
The construct that can be used to check the existence of characters is called a Lookahead.
What is Error Handling?
Error Handling helps in handling software errors gracefully and helps execution to resume when interrupted.
Define Hardcoding Data
Hardcoding Data is the practice of embedding data directly into the source code of a program as opposed to obtaining the data from external sources (e.g., databases, file) or generating it at runtime.
Hardcoding Data - Advantages and Disadvantages
Advantage - Fast delivery of code.
Disadvantage - Considered an anti-pattern.
Disadvantage - Hard to adapt.
Disadvantage - Hard to internationalise.
Disadvantage - Raises security vulnerabilities.
What security issues can a web application have
Source code disclosure enables attackers to understand how the application behaves by simply reading the code and checking for logical flaws, or hardcoded data such as username/password pairs and secret keys.
Hidden Form Fields