Quiz 3 - Intro to Security

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/72

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

73 Terms

1
New cards

Cross Site Scripting (XSS) Attack

  • Occurs when an application takes untrusted data and sends it to a web browser without proper validation or sanitization

  • Allows attacker to execute JavaScript code in victims browser

  • Is used to steal sensitive data such as session ID

2
New cards

XSS Attack Category

Data neutralization issues

  • Same as SQL and OS command injections

3
New cards

STRIDE

Spoofing - Pretending to be someone your not

Tampering - Modifying data you shouldn’t be able to

Repudiation - Someone denies doing an action

Information Disclosure - Exposing data to people who shouldn’t see it

Denial of service - Making a system unavailable to valid user

Elevation of privilege - A user gains permissions they are not supposed to have

4
New cards

XSS Types

  • Reflected

  • Stored

  • DOM-Based

5
New cards

XSS Types - Reflected

The attack script is reflected back to the user as part of a page from the victim site

  • Can link in other websites and email links

6
New cards

XSS Types - Stored

The attacker stores the malicious code in a resource managed by the web such as a database

7
New cards

XSS Types - Dom-Based

Modifying the environment of the victims browser

8
New cards

Cross-Site Request Forgery (CSFR)

  • Requires user to be authenticated

    • Trust in user browser

  • Aims to take unwanted actions on a website where the victim is authenticated

  • Uses malicious scripts stored in the server

  • Involves attacking the victims browser

  • Tries to use session ID to get victim to take unwanted action

9
New cards

Sammy Worm

XSS/CSFR based worm that spread on MySpace

10
New cards

HTTP (Hypertext Transfer Protocol)

  • Stateless protocol

  • HTTP request

  • HTTP Response

  • HTTP response data

11
New cards

Stateless Protocol

Each request is independent, no memory of previous one

12
New cards

HTTP Request

What browser sends

13
New cards

HTTP Response

  • Info about the response

  • Set cookies is here

14
New cards

HTTP Response Data

The actual HTML content

15
New cards

Why do we need sessions

HTTP is stateless, web application need state to identify individual users

16
New cards

What is a session

A lasting connection between a user and a server involving the exchange of many requests

  • Session ID is exchanged between browser and server on every request

17
New cards

How are sessions maintained

  • By a server

  • Stored in file or database

  • Each session has a unique token

18
New cards

Methods used to track sessions

  • Cookies - most common

  • URL

  • Hidden forms

  • IP address

  • Web storage

19
New cards

Cookies

Most common method for tracking session IDs

  • Contains no executable code

  • Submitted with each request to a target website

  • Newer cookies will overwrite old cookies

20
New cards

Why do store session files on a server

  • Cookies files can easily be faked or modified

  • Attacker can create a fake cookie file or modify existing one to bypass entire authentication check

21
New cards

Session Hijacking

The process of taking over an established session to impersonate a user/application

  • Authentication has already taken place

  • The attacker often uses a DoS attack on victim to prevent the user from using the the server at the same time

22
New cards

Two Types of Session Hijacking

  • Active

  • Passive

23
New cards

Session Hijacking - Active

Attacker finds a session between the victim and server and takes it over

  • Usually begins with a passive hijacking attack

24
New cards

Session Hijacking - Passive

The attacker gets between the user and server and records the traffic for later use

25
New cards

Network-Level Hijacking

Involves the interception of packets between user and server

  • ARP poisoning

  • DNS spoofing

  • Attacker must be on the same network as the victim

26
New cards

Application-Level Hijacking

Involves gaining control of the HTTP session by obtaining the session ID

  • Brute force guessing the ID

  • Sniffing encrypted traffic for session IDs

  • Compromising victim machine and pulling the session ID off the computer

27
New cards

How session token could be compomised

  • Predictable / easy to crack session token

  • Session sniffing

  • Man in the middle attack

  • Man in the browser attack

  • Client side attack (XSS)

28
New cards

Session Prediction / Cracking Attack

Focuses on predicting / brute forcing session ID values

29
New cards

Session Sniffing Attack

Use of a sniffer to capture a valid session token, then uses stolen token to gain access to server

30
New cards

Man in the Middle Attack

Involves the attacker placing themselves between the victim and server

  • Data is intercepted modified then retransmitted between the source and destination

  • Attacker acts as a proxy

31
New cards

Man in the browser attack

Same approach as main in the middle but instead relies on malware to intercept and manipulate calls between the browser and user

32
New cards

Session Spoofing

Attacker initiates a new session by using the victims stolen credentials

33
New cards

Session Replay

Attacker captures session IDs then sends them to a server to use at a later time

34
New cards

Session sidejacking

Attack sniffs network traffic to steal session IDs

  • Attacker captures token while it is being transmitted

35
New cards

Session Fixation

Attacker passes session token to user to get authenticated

  • Once authenticated attacker already knows authenticated token

36
New cards

Session Life Cycle

  1. User credentials

  2. Session generation

  3. Session hijacking

  4. Session termination

37
New cards

User credentials —> Session generation Attacks

  • Man in the middle attack

  • Password brute force attack

  • Password dictionary attack

  • Network sniffing

38
New cards

Session generation —> Session handling Attacks

  • Session fixation

  • Cross site scripting

  • Session replay

  • Session spoofing

39
New cards

Session handling —> Session termination

  • Session leakage

  • CSFR

  • Session sidejacking

40
New cards

Set Cookie Flags

  • HTTP Only

  • Secure

41
New cards

Set Cookie Flag - HTTP Only

Prevents the risk of a client side script accessing the protected cookie

  • Protects against XSS, CSFR

  • Denies use of document.cookie

42
New cards

Set Cookie Flag - Secure

Ensures cookies are only sent over HTTPS not HTTP

43
New cards

Session Hijacking and Spoofing Prevention

  • Educate user

  • Use cryptology and random sessions IDs

  • Limit concurrent sessions IDs

  • Time out expire or regenerate sessions IDs

  • Input Validation - protects against XSS and CSRF

  • Force/use SSL for all communication - protects against session sidejacking

  • Encrypt session and cookies data - protects against session sidejacking

  • Force re-authentication and set up authentication - Protects against session fixation

  • Use context data and secondary check for session - Protects against session fixation

  • Destroy invalidated session IDs - Protects against session fixation

44
New cards

Session Timeout and Expiration Methods

  • Browser close

  • Fixed time after authentication

  • Idle session

  • High risk action

45
New cards

Browser Close

Session stay open until the user closes the browser

46
New cards

Fixed time after authentication 

Session expires after set duration

47
New cards

Idle Session

Session expires if the user is going to perform a high risk action, re-authentication is needed

48
New cards

Data Neutralization Issues

The creation or neutralization of data using an incorrect format

49
New cards

OS Command Injection

When an application builds and runs an OS command using untrusted input

  • Can give attacker access to data on computer

  • Attackers us ‘;’ on windows to run multiple commands, and ‘&&’ on Linux to run multiple commands

  • Passes user input to shell

50
New cards

SQL Injection

When an application builds and runs SQL query from untrusted input in a database

  • Can give attacker access to database

  • Passes user input to database

  • Uses single quotes

51
New cards

Power of Single Quotes

Gives syntax error that can reveal info such as actual SQL query

52
New cards

Linux Bash Shell Command Subsitution

Attacker uses $(command) to run commands inside echo statements

  • ‘$(which java)‘ - doesn’t work, output what is inside quotes

  • “$(which java)“ - works, output which java they are using

  • `which java` - works, same as “$()“

53
New cards

Encrypted Bloated Ballots

Uses bash shell command substitution

  • When encrypting a file using gpg attacker get os to run command

54
New cards

How Common is SQL Injection

Most common vulnerability today

  • Flaw from application development

  • Is a input validation problem

55
New cards

Typical SQL Attack Hazards

  • Bypass login

  • Manipulate database data

  • Create database backdoor

  • Read files

  • Distribution of trojan and malware

  • Execute system commands

56
New cards

Three Classes of SQL Injection Attacks

  • Inband

  • Out of band

  • Blind

57
New cards

SQL Injection Classes - Inband

Data is extracted using the same channel that is used to inject the SQL code

58
New cards

SQL Injection Classes - Out of band

Data is retrieved using a different channel

59
New cards

SQL Injection Classes - Blind

No transfer of data

60
New cards

Exploit Techniques of SQL Injection

  • Union operator

  • Boolean

  • Error based

  • Time delay

61
New cards

Exploit Techniques - Union operator

  • Can happen when the flaw happens in a SELECT statement

  • Makes it possible to combine two queries

62
New cards

Exploit Techniques - Boolean

Used to verify whether certain conditions are true or false

  • Used in blind attacks

63
New cards

Exploit Techniques - Error based

Forces database to generate an error giving the attacker information about the code structure

64
New cards

Exploit Techniques - Time delay

Uses database commands to delay answer

  • Used in  blind

65
New cards

Xp_cmdshell

Lets you run system commands

  • Spawns a command shell and passes in a string for execution

66
New cards

Intrusion Detection System (IDS)

A device or software application that monitors a network system for malicious activity

67
New cards

Intrusion Detection System Evasion Techniques

Modifications made in order to prevent detection

  • Obfuscation - encode or hide payload so the end host decodes it but the IDS doesn’t

  • Evasion

68
New cards

Defending Against Injection Flaws

  • Follow and enforce best programming principles

  • Harden OS, servers and 3rd part application

  • Never build SQL/SHELL commands yourself

69
New cards

Parameterized (Prepared) SQL

Allows you to pass in query separately from arguments

70
New cards

Object Relational Mapper (ORM)

Provide an interface between native objects and relational databases

71
New cards

SQL Injection best programming practices

  • Strong design

    • Define an easy secure path to querying data

    • Validate input through generic routine

    • Sanitize user input

    • Seperate application code and SQL code

  • Website audit

    • Monitor database and website activity

    • Check logs

    • Be proactive

72
New cards

JavaScript Injection

Subset of injections attacks

  • JavaScript code is injected into browser or server

  • Happens in XSS attack

  • Happens in CSFR attacks

73
New cards

Proxy

Forwards and filters internet traffic