Computer Science / Software Engineering Notes Network

Cybersecurity

Mathias Ritter

Oli’s Part        4

Introduction        4

Web Applications        13

Vulnerabilities        18

Information Exposure        18

SQL Injection        19

Authorisation Bypass        21

Cross-Site Scripting (XSS)        22

Insecure Cookies        23

Insecure Sessions / Session Vulnerabilities        24

Insecure File Upload        25

Cross-Site Request Forgery (CSRF)        26

Internal Information / Information Leakage        29

Parameter Manipulation        30

Application Logic        30

Out of Date Software        31

File Inclusion        32

Open Redirects        33

Brute Force        33

Tools & Techniques        34

Penetration Testing        39

Ed’s Part        46

Threats - range and type        46

Malware        48

Trojan Horse        49

Virus        50

Computer Worms        51

Bots and Botnets        53

Adware and Spyware        53

Scareware        54

Hoaxware        54

Ransomware        54

Backdoor/Trapdoor        55

Keylogging        55

Rootkits        56

Additional forms of malware and topics        56

Introduction to Cryptography        57

Encryption - symmetric and asymmetric        58

Historical and simple ciphers        60

Codes and ciphers        61

One-Time Pad (OTP)        61

Random Numbers        62

Data Encryption Standard (DES)        62

Advanced Encryption Standard (AES)        66

Galois Field (GF)        68

picoAES5        69

picoAES7        70

picoAES8        73

AES continued        75

Multi-Block Ciphertexts & Block Cipher Modes        76

Asymmetric Encryption        77

RSA (Rivest-Shamir-Adelman)        77

Message Authentication - Cryptographic Hash Functions        78

SHA-1        79

SHA-2        81

Key Exchange        81

Authentication Protocols        82

Digital Signatures and Electronic Contracts        83

X.509 Certificates and Certificate Authorities        84

Nawful’s Part        86

Authentication        86

Models        87

Types of Authentication        87

Authentication Systems        88

Passwords        89

Physical Biometrics        90

Behavioral Biometrics        91

How Biometrics Work        91

Biometric Issues        92

Threats to Authentication Procedures and Data        93

Morris and Thompson paper        95

Encryption Guidelines        95

Pervasive Monitoring (PM): From Bad to Worse        96

Definition and Introduction        96

Examples        96

Motivation        97

Pervasive Monitoring and other Stuff        97

Defense        98

Why it will not go away        99

Consequences        99

Advanced Persistent Threats (APT)        99

Definition        99

Sponsors & Attackers        100

Discovering APT        101

Technical & Behavioral Characteristics        101

Anatomy        102

Zero-day Vulnerability        103

Discovery & Defending APT        103

Use Case - Stuxnet        104

Stages of Attacks, Killchain and Mitre Att&ck        105

Diamond Model        106

Use Case        106

Security Engineering - Landscape and Policies        113

Introduction        113

Framework, Model & Policy        113

Maturity Model        114

Security Architecture - Reference Diagrams        115

Threat Analysis        118

Policy Planning        118


Oli’s Part

Introduction

System

Customer database linked to online shop

Risk

Customer details could be stolen by attacker

How to avoid?

Encrypt database so only encrypted details could be stolen

How to minimise?

Penetration testing to reduce risk of public vulnerabilities

Mitigation if it occurs?

On detecting a breach, immediately shut down site

 

Web Applications

GET

GET denotes the type of the request (more on that below)

/

/ is the URI (Uniform Resource Identifier). You basically have different URIs for different information so you can tell the server what you want. They work just like paths, so the slash denotes the root of the web server.

HTTP/1.1

HTTP/1.1 denotes the protocol and the version

HTTP/1.1

HTTP/1.1 denotes the protocol and the version

200 OK

200 is the status code and OK is the description of it. So the status code 200 basically means that the server says everything is OK, here is your response.

Request Type

What it should be used for

Example

GET

Query a resource

Get a user’s profile data

POST

Create a resource

Sometimes also: Update a resource

Create a new user

Sometimes also: Update a user’s profile

PUT

Update a resource

Update a user’s profile

DELETE

Delete a resource

Delete a user

Where

Example

Data

Structure

Purpose

URI parameter

/users/5

5

Values in the URL separated by “/”

View the user with the id “5”

Query parameter

/search?q=Southampton

q=Southampton

Key value pairs separated by “&”

Search for “Southampton”

Body

{ name: “Oli” }

E.g. JavaScript object (JSON)

Can be anything as long as the server knows how to understand it

Create a new user with name “Oli”

Header

Authorization: Basic QWxhZGR

E.g. a string

Key value pairs separated by “:”

Send a token for authorisation

Vulnerabilities

Information Exposure

SQL Injection

Inputs

Query

Result

Username = Oli

Password = something

SELECT * FROM users WHERE username=‘Oli’ AND password=‘something

User logged in if username and password match

Username = Oli

Password = something’ OR 1=‘1

SELECT * FROM users WHERE username=‘Oli’ AND password=‘something’ OR 1=‘1

User will be logged in as Oli because the OR binds tighter and 1=’1’ evaluates to true

Username = Oli’ --_

Password = something

SELECT * FROM users WHERE username=‘Oli’ -- ’ AND password=‘something

User will be logged in as Oli because everything after the username gets commented through using the double dash

Authorisation Bypass

Cross-Site Scripting (XSS)

Insecure Cookies

Insecure Sessions / Session Vulnerabilities

Insecure File Upload

Cross-Site Request Forgery (CSRF)

Internal Information / Information Leakage

Parameter Manipulation

Application Logic

Out of Date Software

File Inclusion

Open Redirects

Brute Force

Tools & Techniques

Penetration Testing

  1. Be systematic: Make a list of all possible inputs so you make sure that you don’t miss anything
  2. Be logical: What is the code behind the logic? If you were the developer, what code would you write to implement this logic?
  3. Map out what you’re doing: Create a spreadsheet to show the structure of the page
  4. Use tools to help you, e.g. Burp Suite
  5. Be the anti user: Test user inputs that are usually not expected, e.g. a negative number, a string when there is a number expected etc.
  6. Intercept and manipulate: Use tools like burp suite to change the request
  7. Cheat: Use cheat sheets
  8. Don’t give up

  1. Be systematic

  1. Be Logical

  1. Map out what you’re doing

  1. Use tools to help you

  1. Be the anti-user

  1. Intercept and manipulate

  1. Cheat

  1. Don’t give up

Ed’s Part

Threats - range and type

  1. Stand-alone computers (no network connection)

  1. Distributed computer (private network)

  1. Distributed computer (internet)

  1. Server with website (internet)

Malware

Trojan Horse

Virus

Computer Worms

Bots and Botnets

Adware and Spyware

Scareware

Hoaxware

I got it, then may be I passed it to you too, sorry. The name of the virus is jdbgmgr.exe and is transmitted automatically through the Messanger and addresses book of the OUTLOOK.

The virus is neither detected by Norton nor by Mc Afee. It remains in lethargy ("sleeping") for 14 days and even more, before it destroys the whole system. It can be eliminated during this period.”

Ransomware

Backdoor/Trapdoor

Keylogging

Rootkits

Additional forms of malware and topics

Introduction to Cryptography

Encryption - symmetric and asymmetric

Historical and simple ciphers

Codes and ciphers

One-Time Pad (OTP)

Random Numbers

Data Encryption Standard (DES)

Advanced Encryption Standard (AES)

Galois Field (GF)

picoAES5

picoAES7

  1. SubBytes
  2. ShiftRows
  3. MixColumns
  4. AddRoundKey

2

4

3

5

6

1

0

M =

2

3

1

2

M’ =

2

4

6

2

1

2

3

4

1

2

3

4

  1. SubBytes
    We substitute the numbers of the state using the S box provided above to get a new state

To substitute a number “n” take the nth index of the S box

1

2

3

4

substitute

2

4

3

5

6

1

0

=

4

3

5

6

  1. ShiftRows
    We shift the bottom row by one to the left (swap elements) to get a new state

4

3

5

6

shift =

4

3

6

5

  1. MixColumns
    We multiply the mix columns matrix M with each column of the state to get a new state
    If any result is >= 7 we need to mod 7 it
    First, we start with the left column of the state

2

3

1

2

*

4

6

=

26

16

mod 7 =

5

2

We continue with the right column of the state

2

3

1

2

*

3

5

=

21

13

mod 7 =

0

6

We combine both columns to get the new state

5

0

2

6

  1. AddRoundKey
    We add the round key to the state

If any result is >= 7 we need to mod 7 it

5

0

2

6

+

1

2

3

4

=

6

2

5

10

mod 7 =

6

2

5

3

final state

5

3

6

2

  1. InvAddRoundKey

The inverse of AddRoundKey, so we need to subtract the key from the state

If any number becomes < 0 we need to add 7

5

3

6

2

-

1

2

3

4

=

4

1

3

-2

4

1

3

5

  1. InvMixColumns

Same as MixColumns except that we use M’ (the inverse of M we used in MixColumns) for the multiplication

First, we start with the left column of the state

2

4

6

2

*

4

3

=

20

30

mod 7 =

6

2

We continue with the right column of the state

2

4

6

2

*

1

5

=

22

16

mod 7 =

1

2

We combine both columns to get the new state

6

1

2

2

  1. InvShiftRows
    Same as ShiftRows except that we shift in the opposite direction (right not left)

For picoAES it doesn’t matter whether we shift left or right as we just swap the bottom two elements

6

1

2

2

shift =

6

1

2

2

  1. InvSubBytes

Same as SubBytes except that we substitute in the other direction

Therefore, we substitute the number through the index of where it appears in the S box

6

1

2

2

inverse substitute

2

4

3

5

6

1

0

=

4

5

0

0

final state

picoAES8

x/y

0

1

2

3

4

5

6

7

0

0

0

0

0

0

0

0

0

1

0

1

2

3

4

5

6

7

x/y

0

1

2

3

4

5

6

7

2

0

2

4

6

3

1

7

5

Expl.

0001 ←

0010

0010 ←  

0100

0011 ←  

0110

0100 ←  

1000 -

1011 =

0011

0101 ←

1010 -

1011 =

0001

0110 ←

1100 - 1011 =

0111

0111 ←

1110 -

1011 =

0101

x/y

0

1

2

3

4

5

6

7

3

0

3

6

5

7

4

1

2

Expl.

0001 +

0010 =

0011

0010 +  

0100 =

0110

0011 +  

0110 =

0101

0100 +  

0011 =

0111

0101 +

0001 =

0100

0110 +

0111 =

0001

0111 +

0101 =

0010

AES continued

Multi-Block Ciphertexts & Block Cipher Modes

Asymmetric Encryption

RSA (Rivest-Shamir-Adelman)

Message Authentication - Cryptographic Hash Functions

SHA-1

SHA-2

Key Exchange

Authentication Protocols

Digital Signatures and Electronic Contracts

X.509 Certificates and Certificate Authorities


Nawful’s Part

Authentication

Models

Types of Authentication

Authentication Systems

Passwords

Scenario

Online attack

Offline attack

Massive cracking array scenario

Description

The attacker has to send requests to a server to check the password attempt

The attacker has the hashed password locally

The attacker has the hashed password locally and uses supercomputers

Number of guesses

One thousand guesses per second

One hundred billion guesses per second

One hundred trillion guesses per second

8 character password

70.56 centuries

36.99 minutes

2.22 seconds

10 character password

2.71 hundred thousand centuries

3.25 months

2.37 hours

Physical Biometrics

Behavioral Biometrics

How Biometrics Work

Biometric Issues

Threats to Authentication Procedures and Data

Morris and Thompson paper

Encryption Guidelines

Pervasive Monitoring (PM): From Bad to Worse

Definition and Introduction

Examples

Motivation

Pervasive Monitoring and other Stuff

Defense

Why it will not go away

Consequences

 

Advanced Persistent Threats (APT)

Definition

Sponsors & Attackers

Discovering APT

Technical & Behavioral Characteristics

Anatomy

Zero-day Vulnerability

Discovery & Defending APT

Use Case - Stuxnet

Stages of Attacks, Killchain and Mitre Att&ck

Active Attacks

Kill Chains

Mitre Att&ck

1 Reconnaissance

1 Reconnaissance

2 Scanning

2 Weaponization

3 Gaining Access

3 Delivery

1 Initial Access

4 Maintaining Access

4 Exploitation

2 Execution

5 Installation

3 Persistence

4 Privilege Escalation

5 Defence Evasion

6 Credential Access

7 Discovery

8 Lateral Movement

9 Collection

6 Command and Control

10 Command and Control

11 Exfiltration

5 Clearing Tracks

7 Actions on Objectives

12 Impact

Diamond Model

Use Case

Item

Kill Chain

Diamond

mail-linkedin@gmx.com

Delivery

Infrastructure

98.126.223.106

Delivery

Infrastructure

Thread-Index: [Value]

Delivery

Capability

Date: Tue, 10 Dec 2013 00:50:49 -0800

Delivery

Capability

hostmaster@mail-linkedin.com

Delivery

Infrastructure

X-Mailer: mlx 5.1.7

Delivery

Capability

Boundary: [Value]

Delivery

Capability

http://mail-linkedin.tk/mail/auth.php

Exploit

Infrastructure

Payload.exe

Install

Capability

Item

Kill Chain

Diamond

Email address: alice.smith@example.net

Delivery

Infrastructure

Sender IP: 192.0.2.42

Delivery

Infrastructure

Attachment: runmex.exe

Exploit

Capability

Network traffic: GET /callhome.php

Install

Capability

Item

Kill Chain

Diamond

GET /aotj/581/link.php?a=5&z=SGVsbG8gV 29ybGQ&f=476f6f6462796500 HTTP/1.1

C&C

Capability

Host: mail-linkedin.tk

C&C

Infrastructure

User-agent: Mozilla 4.4

C&C

Infrastructure

Item

Kill Chain

Diamond

Email address: <Alice.smith@example.com>

Delivery

Infrastructure

Email headers: X-Mailer: enom1856 & X-Campaign:

Delivery

Capability

Sender IP: 2001:0DB8:1de:ad00::1

Delivery

Infrastructure

Attachment: update.pdf.exe

Exploit / Install

Capability

Network traffic

GET /callhome.php HTTP/1.0

POST /callhome.php HTTP/1.1

C&C

Act on Objectives

Capability

Domains and IPs

acme.example.net

198.51.100.5

2001:0DB8:1d3:ad00::5

C&C

Infrastructure

Destination IP for FTP

198.51.100.6

Act on Objectives

Infrastructure

Security Engineering - Landscape and Policies

Introduction

  1. Select a framework
  2. Select a maturity model
  3. Develop a security architecture
  4. Prioritise security investment and effort

Framework, Model & Policy

Maturity Model

Security Architecture - Reference Diagrams

Threat Analysis

Policy Planning