InfoSec General Flashcards

1
Q

Describe the OWASP Top 10 Web App vulnerabilities and mitigation(s) for each

A

https://owasp.org/www-project-top-ten/

-Injection (SQL, NoSQL, OS, LDAP)
—-Mitigations: Prepared statements, input whitelists

-Broken authentication
—-Mitigations: Multifactor, limits or delays on failed logins

-Sensitive data exposure
—-Mitigations: Don’t store sensitive data unnecessarily; encrypt all data at rest

-XML External Entities (XXE)
—-Mitigations: Use JSON instead of XML where possible; disable XXE and DTD

-Broken access control
—-Mitigations: Deny by default; log access control failures and monitor for repeated failures

-Security misconfiguration
—-Mitigations: Minimal features (remove unused features); automated setup of new environments

-Cross-site scripting (XSS)
—-Mitigations: CSP; escaping untrusted request data.

-Insecure deserialization
—-Mitigations: Only permit serialization of primitive data types; log deserialization exceptions and failures.

-Dependencies with known vulnerabilities
—-Mitigations: Remove unused dependencies; continuously inventory the versions of both client-side and server-side components.

-Insufficient logging/monitoring
—-Mitigations: Ensure all login, access control failures, and server-side input validation failures can be logged with sufficient user context.

New items from 2021 draft:
-Insecure design
-Software/data integrity failures
-Server-side request forgery (SSRF)

https://portswigger.net/daily-swig/owasp-shakes-up-web-app-threat-categories-with-release-of-draft-top-10

Java examples of insecure deserialization:
https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet

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

What happens when you type https://google.com into the address bar and press enter?

A

Assumptions:
-My IP and IP/MAC addresses of gateway and first-hop DNS server are known (if not, DHCP and ARP are used)
-Nothing is cached by DNS servers
-Using TCP rather than QUIC
-DNS resolver does a recursive query

DNS resolution:
-Check browser cache
-Check system hosts file
-Check system cache
-Check remote DNS server:
–Check root (e.g., “.”) authoritative nameserver (returns IP or next name server)
–Check TLD (e.g., “com”) authoritative nameserver (returns IP or next name server)
–Check organization’s/authoritative nameserver (returns IP)

Browser opens a TCP socket (consisting of resolved IP and generally port 443 for HTTPS)

TCP three-way handshake (connection establishment):
-Client sends a SYN (with random sequence number A)
-Server sends SYN/ACK (with ack number A+1 and random sequence number B)
-Client sends ACK (with ack number B+1 and sequence number A+1)
-TCP connection is now established

TLS handshake:
-Client hello: sends supported TLS versions, cipher suites, extensions (like OCSP stapling), and a string of random bytes (client random)
-Server hello: sends chosen cipher suite, SSL certificate, and server random. Also chooses which available extensions to use.
-Authentication: Client verifies server’s SSL certificate with issuing CA
-Premaster secret: Client sends another random byte string, encrypted by server pubkey which is derived from the server certificate (only decryptable with server private key)
-Premaster decryption: Server decrypts premaster secret with private key
-Session key creation: Client and server generate session key with client/server random and premaster secret
-Client sends encrypted “finished” message
-Server sends encrypted “finished” message
-Subsequent communications are also encrypted with the session key

HTTP connection:
-Client sends a GET request to the server for the requested path
-Server responds with web data of the page (HTML/JS/CSS)
-Subsequent requests are sent for images, etc. used by the web page

TCP connection termination:
-Connection closer (either client or server) sends a FIN packet
-Receiver sends ACK followed by a FIN
-Closer sends ACK

Browser closes socket FD

Browser renders web data (likely happens simultaneously with other steps as web data is loaded)

More info: https://github.com/alex/what-happens-when

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

[IP Routing protocols] Name two Interior Gateway Protocols and one Exterior Gateway Protocol

A

Interior: OSPF, IS-IS
Exterior: BGP (outdated: EGP)

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

Describe the OWASP Top 10 API vulnerabilities and mitigation(s) for each

A

https://owasp.org/www-project-api-security/

-Broken object-level authorization
-Broken user authentication
-Excessive data exposure
-Lack of resources & rate limiting - leaves API open to DoS, brute force, mass requests, etc.
-Broken Function Level Authorization
-Mass Assignment
-Security Misconfiguration
-Injection
-Improper Assets Management
-Insufficient Logging & Monitoring

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

Describe the OWASP Top 10 mobile vulnerabilities and mitigation(s) for each

A

https://owasp.org/www-project-mobile-top-10/

-Improper Platform Usage
-Insecure Data Storage
-Insecure Communication
-Insecure Authentication
-Insufficient Cryptography
-Insecure Authorization
-Client Code Quality
-Code Tampering
-Reverse Engineering
-Extraneous Functionality

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

Explain DHCP (and potential attacks/mitigations)

A

Dynamic Host Configuration Protocol

(over UDP)

-Client sends a DISCOVER message to broadcast IP address (255.255.255.255) to find the DHCP server
-DHCP server reserves an IP address for the client and sends an OFFER message with the new IP.
-Client sends a REQUEST (still to broadcast) for the IP
-Server sends an ACK to confirm the client’s new IP address.

Other information communicated via DHCP:
-Gateway
-DNS servers
-NTP servers

Attacks:
-DHCP starvation (DoS): Flood server with requests to exhaust available IP addresses
-DHCP spoofing: Create a fake DHCP server (often used after starvation attack). Clients will then use attacker as gateway

Mitigations: DHCP snooping

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

Explain TCP:
-Overview
-Example protocols
-Connection establishment
-Reliable transmission
-Flow control
-Congestion control
-Connection termination

A

Transmission Control Protocol (TCP): Connection-oriented, provides error checks, guaranteed delivery of packets and also re-transmits packets when dropped, flow control not to overwhelm the receiver, and congestion control based on frequency of lost data. Reliable (and in-order) transmission is ensured by sequence numbers.

TCP examples: FTP, HTTP, SSH

Three-way handshake (connection establishment):
-Client sends a SYN (with random sequence number A)
-Server sends ACK (with ack number A+1 and random sequence number B)
-Client sends (with ack number B+1 and sequence number A+1)

At this point, arbitrary data is sent by the client (for example, TLS hello). First packet has sequence number A+1 and ack number B+1 again.

Reliable transmission:
-All messages contain a sequence number to keep track of order/number of bytes to be received.
-Every TCP message has a 2-byte checksum in the TCP header
-Retransmission:
–On timeout
–On lost segment (detected by ACK with repeated seq number, sent by receiver when a segment is received before one that’s expected)

Flow control: https://www.brianstorti.com/tcp-flow-control/
-Data receiver advertises a Receive Window (rwnd) which is the spare room in the TCP receive buffer. This is sent with every ACK.
-There is a sliding window controlling the number of bytes in flight (not yet received). This is based on the last-known rwnd and the number of bytes that have not yet been ACKed.

Congestion control:
-Based on frequency of lost data
-@TODO: More info?

Connection termination:
-Connection closer (either client or server) sends a FIN packet
-Receiver sends ACK followed by a FIN
-Closer sends ACK
-Image: https://upload.wikimedia.org/wikipedia/commons/thumb/5/55/TCP_CLOSE.svg/1280px-TCP_CLOSE.svg.png

Attacks:
-SYN flood (DDoS): https://www.cloudflare.com/learning/ddos/syn-flood-ddos-attack/
-Mitigation: Set a maximum number of half-open TCP connections, and kill the oldest one if a new connection comes in and the limit has been reached.

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

Explain ARP (and potential attacks/mitigations)

A

(Over Ethernet or IP or other protocols)

ARP is used to resolve the MAC address associated with an IP address

Works in two ways:
-Announcements
-Request/response

Attack:
-ARP caches can be poisoned by ARP spoofing (responding to ARP requests that aren’t for you)

-Mitigation: ARP snooping

-Note: Neighbor Discovery Protocol (NDP) replaces ARP in IPv6 networks

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

SAST vs DAST? Strengths/weaknesses of each?

A

-Static Application System Testing (SAST) - Analysis of source code to detect known vulnerabilities. More akin to white box testing

Strengths (SAST):
-Cheaper and easier to fix problems in production

Weaknesses (SAST):
-Automation can lead to false positives
-Automated systems have trouble detecting more complex application-specific logic vulnerabilities

Examples (SAST): SonarQube, KlocWork

-Dynamic Application Security Testing (DAST) - Analysis at runtime. e.g., fault injection testing such as fuzzing. More akin to black box testing

Strengths (DAST):
-Can find issues in production builds

Weaknesses (DAST):
-Can’t get 100% code coverage

Examples (DAST): ZAP, WebInspect

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

Describe ways you have automated a process

A

-Job 2: Penetration Test request/planning process

-Music database population - given a set of MP3 files with metadata:
–Parsed metadata with ffmpeg Python bindings
–Used beautiful soup and Genius API to search Genius, fetch lyrics, and extract them from HTML data
–Used regex to determine whether lyrics contained profanity
–Used Google images API and very refined search parameters to fetch album art
–Populated MySQL database with MP3 metadata, lyrics, and profanity flag

-Same project (Audium), I created MySQL procedures for randomly-generating users, playlists, and listens

-More recently, DXMD daily challenge fetching:
–Created a server emulator for the game’s back-end API
–Patched a copy of the game executable to use my server
–Created a script that starts the server, starts the game, extracts an authentication ticket from the game web request (using the server emulator), kills both processes, creates a well-formed web request for the daily challenge API endpoint, sends the request to the real-world server, and stores the configuration with a file name that is the current date.

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

How do you stay up-to-date on the current threat landscape?

A

-Reddit /r/netsec
-DayZeroSec podcast
-ARSTechnica
-Twitter - follow interesting InfoSec people and companies, and subscribe to InfoSec topics
-Tailored my Google news feed to show me InfoSec news
-Occasionally: Google Project Zero, Android Security Blog, Krebs on Security, Schneier on Security

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

Describe Mitre ATT&CK

A

https://attack.mitre.org/

High-level techniques:
-Reconnaissance
-Resource development
-Initial access
-Execution
-Persistence
-Privilege escalation
-Defense evasion
-Credential access
-Discovery
-Lateral movement
-Collection
-Command and control
-Exfiltration
-Impact

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

What is the SDLC? List the phases. What are some effective ways of securing the SDLC?

A

SDLC: Software/System/Security Development Life Cycle

Stages:
-Requirement analysis
-Planning
-Software/architecture design
-Software development
-Testing
-Deployment

Securing the SDLC:
-Generally, “shift security left” by including security considerations/checks/testing in every phase of the SDLC
-Static Application System Testing (SAST) - Analysis of source code to detect known vulnerabilities (white box testing)
-Dynamic Application Security Testing (DAST) - Analysis at runtime. e.g., fault injection testing such as fuzzing
-Interactive Application Security Testing (IAST) - combination of SAST and DAST
-Secrets detection - check for leaked API keys, credentials, and private keys (for signing apps, etc.)
-Dependency scanning - check for vulnerabilities in dependencies
-Runtime Application Self Protection (RASP) - Detects attacks in real-time. RASP tools analyze behavior of an application within its context.

See also Microsoft SDL 12 practices:
https://www.microsoft.com/en-us/securityengineering/sdl/practices

-Provide training
-Define security requirements
-Define metrics & compliance reporting
-Perform threat modeling
-Establish design requirements
-Define and use cryptography standards
-Manage the security risk of using third-party components
-Use approved tools
-Perform SAST
-Perform DAST
-Perform penetration testing
-Establish a standard incident response process

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

Discuss anything you have done to prevent attacks that could potentially compromise large systems, company trust, or customer data

A

Hobby project: Reverse engineering and analysis of Square Enix OnlineSuite (used in several games)

Discovered and reported customer PII/account information disclosure vulnerability

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

Android and platform security - anything else to discuss? Application security lifecycle?

A

@TODO

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

Discuss a scenario where you’ve made a decision without higher up/manager approval

A

Null answer:
I can’t say I’ve ever gone over a manager’s head on anything significant; if I were to do something like that I would have high confidence it was beneficial to our work and that there were no significant risks to the organization. Note that although Amazon has a leadership principle about “Bias towards action,” the opposite is true in the national security space. They want you to carefully consider everything you do and consult a security officer if you have any doubts.

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

Describe a situation where you both met a goal and went above and beyond with your work

A

-Job 1
-Generally the manager creates work plans and finds customers
-I found an obscure story about a mobile app being used in a specific region that was of interest to one of our customers whose contract was going to expire
-I brought this to my manager’s attention and convinced him to make a new work plan around it
-Turned into a several-month (part time) project gathering news and reverse engineering the app to explain its functionality from a technical perspective, as well as contextual research about its usage and prevalence in society in that region.
-Delivered white papers, slides, and documentation about a proprietary TCP protocol I reverse-engineered (used by the app)

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

Describe the differences between TCP and UDP

A

Transmission Control Protocol (TCP): Connection-oriented, provides error checks, guaranteed delivery of packets and also re-transmits the packets when dropped, flow control not to overwhelm the receiver, and congestion control based on frequency of lost data. Reliable (and in-order) transmission is ensured by sequence numbers.

TCP examples: FTP, HTTP, SSH

User Datagram Protocol (UDP): Connectionless, doesn’t care if the packets are received, no order maintained, no flow control. UDP is faster than TCP. Generally, UDP datagrams with bad checksums are dropped.

UDP datagram structure: source port, dest port, length, checksum, data

UDP examples: Video streaming, online games, DNS (generally), DHCP

https://en.wikipedia.org/wiki/User_Datagram_Protocol#Comparison_of_UDP_and_TCP

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

DDOS attack and remediations? L3, L4, L7

A

https://www.cloudflare.com/learning/ddos/layer-3-ddos-attacks/

“I explained how a CDN can absorb all the attacks before they reach target server.- Not sure if he was satisfied”

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

Cloud Security - IAM vs STS?

A

AWS Identity and Access Management (IAM):
-@TODO

AWS Security Token Service (STS):
-@TODO

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

Have you done anything innovative recently?

A

Yes:
-Job 1
-Developed a novel (post-auth) technique to obtain a root shell on a popular consumer router.
-Did so via the configuration backup/restore mechanism
-Leveraged a file write vulnerability in the config extraction to create a cron job for command execution
-Innovative part: Uploading a config would cause the device to restart, deleting the malicious cron job. I worked around this by feeding a malformed configuration to the device, causing the mechanism to fail out before restarting (allowing the malicious cron to persist).

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

Describe how a VPN connection works

A

Virtual Private Network (VPN)

Extends a private network across other network(s).

Use cases include LAN functionality across networks, masking IP address, and protecting communications.

Common protocols used include IPsec, TLS, DTLS, and WireGuard

TCP-based VPNs are generally not recommended due to the “TCP Meltdown” problem: https://openvpn.net/faq/what-is-tcp-meltdown/

23
Q

Hashing vs. encryption?

A

Hashing is a one-way mechanism that essentially calculates a unique value for any specific piece of data. It can be used to store data in an “unrecoverable” state that still allows verification of said data if it is encountered again.

Encryption is a two-way mechanism that allows for recovery of plaintext from ciphertext given the correct secrets and algorithm.

24
Q

Symmetric vs asymmetric encryption? Examples of each?

A

Symmetric: One shared secret. Examples: AES, DES, RC4

Asymmetric: Each participant has a key pair, shares public keys, and encrypts data with others’ pubkeys (to be decrypted with the corresponding private key). Examples: RSA, ECC, Diffie-Hellman key exchange

25
Q

Explain CSRF. How to remediate?

A

CSRF is when an attacker leverages session cookies in a victim’s browser to induce an action (via the victim submitting a form or clicking a URL) in a web app.

Cross-site request forgery requires three conditions:
-An action in the web app that an attacker would want to induce
-Cookie-based session handling
-No unpredictable request parameters

Mitigations:
-Require a one-time CSRF token with every relevant user request. The token should be unpredictable, tied to the user’s session, and delivered to the user in a previous server response.
-(Partial mitigation) SameSite cookies

26
Q

Tell me about a goal and the steps you took the accomplish

A

-Job 1
-Had a weak understanding of layer 2 protocols and switching
-Goal: Learn more about this topic
-Got involved with architecting our internal lab network (configuring a Cisco switch and some Ubiquiti gear)
-Read about Ethernet addressing in my free time
-Became competent on the topic
-Contributed to a work plan about novel uses of layer 2 protocols

27
Q

Tell me about a time you went through a personal obstacle or challenge

A

-Working at Job 1
-Decided I wanted to do the OSCP
-Couldn’t spend work time on it
-Spent vast majority of my free time studying for it
-Fiancée was bummed because I wasn’t spending enough time with her, skipping meals etc.
-Came to an agreement to hang out every Friday night and get brunch on Sundays together until I was finished studying

28
Q

Tell me about a time when you took on something you weren’t required to do

A

-Working at Job 1
-Early in Covid (first few weeks)
-Entire team was working from home
-Arrangement with customers was no remote technical work
-Wrote some white papers, but customers weren’t super keen on the output
-Volunteered to come back in to re-start technical work to keep good customer relations

29
Q

Tell about a time that you had a big impact on a project.

A

-Job 1
-Generally the manager creates work plans and finds customers
-I found an obscure story about a mobile app being used in a specific region that was of interest to one of our customers whose contract was going to expire
-I brought this to my manager’s attention and convinced him to make a new work plan around it
-Turned into a several-month (part time) project gathering news and reverse engineering the app to explain its functionality from a technical perspective, as well as contextual research about its usage and prevalence in society in that region.
-Delivered white papers, slides, and documentation about a proprietary TCP protocol I reverse-engineered (used by the app)

30
Q

How to change the static IP on a PC?

A

Linux:
-For current session: ifconfig/ip a
-Permanently: /etc/network/interfaces

Windows:
-netsh command

DHCP:
-IP reservation (configuration setting to always assign the same IP to a specified MAC address)

31
Q

Explain TLS:
-What mechanisms does it support?
-Describe the TLS handshake

A

Transport Layer Security (previously Secure Sockets Layer or SSL) (over TCP)

During the TLS handshake, client/server negotiate:
-TLS version (1.0, 1.2, 1.3, etc.)
-Cipher suites to use
-Extensions (support offered by client and server chooses which, if any, it wants to use)
-Authenticate the server’s identity using the server’s public key, preferably signed by a Certificate Authority (CA)
-Create session keys for subsequent symmetric encryption

TLS handshake:
-Client hello: sends supported TLS versions, cipher suites, extensions, and a string of random bytes (client random)
-Server hello: sends chosen cipher suite, SSL certificate, chosen extensions, and server random
-Authentication: Client verifies server’s SSL certificate with issuing CA
-Premaster secret: Client sends another random byte string, encrypted by server pubkey which is derived from the server certificate (only decryptable with server private key)
-Premaster decryption: Server decrypts premaster secret with private key
-Session key creation: Client and server generate session key with client/server random and premaster secret
-Client sends encrypted “finished” message
-Server sends encrypted “finished” message
-Subsequent communications are also encrypted with the session key

TLS extensions:
–Server Name Indication: Sends destination hostname in the handshake. Useful if multiple domains hosted on the same IP. (Solved by Host header in HTTP)
–Elliptic Curve capabilities: Client specifies which ECCs it supports.
–Session tickets: For resuming sessions to avoid costly TLS handshake
–Status request/OCSP stapling: Pre-verified data about server cert
–Certificate compression: Specify whether to compress and what algorithm

Attacks:
-Downgrade attacks

More information:

TLS extensions: https://blog.susanka.eu/what-are-tls-extensions/

https://superuser.com/questions/620121/what-is-the-difference-between-a-certificate-and-a-key-with-respect-to-ssl

32
Q

Threat modeling

A

Organizational red/blue team:
-Use Mitre Att&ck framework (https://attack.mitre.org/):
–Identify APTs with interest in your business sector
–Identify techniques used by relevant threat actors
–Create detection routines and mitigations for these techniques
–Test your defenses to determine your effectiveness with regard to detection and mitigation
–Create a threat matrix to determine where holes might still exist

See also: https://medium.com/mitre-attack/getting-started-with-attack-red-29f074ccf7e3

System/application:
-Information collection: Identify assets, actors, entry points, components, use cases, and trust levels
-Create a data flow diagram (UML) with the gathered information on the system (high level)
–If necessary, break this down into sub-diagrams
-Identify a list of threats (and build attack trees for each threat).
-Triage threats (e.g., using your own experience/judgement or with Microsoft’s DREAD rating and/or threat matrices)
-Per threat, identify mitigations, which may include security control implementations (e.g., add mitigation nodes to your attack trees).
-Implementation review: Calculate the sum of risk ratings for each affected component to prioritize which components to assess.

Example information collection techniques:
-Developer interviews
-Design documentation
-Standards documentation
-Source code profiling/analysis
-Runtime system profiling (what files, registry entries, etc. are created/read/written)

Example information items:
-Assets: databases, credentials, networks, documents, systems, access (e.g., code execution), buildings, etc.
-Actors: Normal users, erroneous users (e.g., accidentally pushed dev build to prod), malicious intruders, web crawlers, external systems that interact with the application, etc.
-Entrypoints: Services listening on ports, RPC endpoints, file uploads, client actions, etc.
-Components: Classes, processes, etc.
-Use cases: All potential applications of the system, including authorized and unauthorized scenarios

Example design diagrams: See page 57 of The Art of Software Security Assessment; also https://www.youtube.com/watch?v=ztZsEI6C-mI

Example attack trees: See pages 59, 61, & 62 of The Art of Software Security Assessment

DREAD rating (each from 1-10):
-Damage potential
-Reproducibility
-Exploitability
-Affected users
-Discoverability
(Add all ratings and divide by 5 for overall rating)

Example threat summary with DREAD rating: See page 64 of The Art of Software Security Assessment

Example threat matrix: https://www.researchgate.net/profile/Gulsum-Kaya/publication/323570642/figure/fig7/AS:625770716217345@1526206773610/A-standard-risk-matrix.png

Other reading:
https://aws.amazon.com/blogs/security/how-to-approach-threat-modeling/

Other frameworks:
-STRIDE
-PASTA
-OCTAVE (SEI)
-VAST
-Trike

33
Q

How to secure a SQL database?

A

-Isolate the server to a dedicated host
-Keep the host and server software updated
-Use strong administrator passwords
-Keep logs of DB logins
-Create regular (off-site) backups
-Disable features like xp_cmdshell on MSSQL and MySQL user-defined functions
-Follow least-privilege when assigning permissions
-Prevent injections in application code by using stored procedures and prepared statements

34
Q

What challenges did you face in previous jobs and how did you overcome them?

A

-Job 1
-Had a weak understanding of layer 2 protocols and switching
-Got involved with architecting our internal lab network (configuring a Cisco switch and some Ubiquiti gear, configuring VLANs, etc.)
-Read about Ethernet addressing in my free time
-Became competent on the topic
-Contributed to a work plan about novel uses of layer 2 protocols

35
Q

How to intercept traffic between a victim and a webserver?

A

-Man in the Middle (MitM) on an intermediate host. In modern systems using TLS this generally requires adding your own certificate to the list of trusted certificates on the client, which can further be defeated by application-specific certificate pinning. Alternatively, one would have to compromise the upstream server’s SSL certificate or a CA certificate.

-If you have access to process memory, inject hooks at data ingress/egress functions to view/modify traffic

36
Q

[Container technology] Describe Docker and Kubernetes

A

Docker:
-Container technology: creates an isolated environment for applications
-Often used for building and deploying applications (CI/CD)

Kubernetes:
-Infrastructure for managing multiple containers
-Often used after container deployment for scheduling and managing containers (multiple docker containers can run on a Kubernetes instance). Kubernetes is more akin to Docker Swarm.

See also: https://www.youtube.com/watch?v=9_s3h_GVzZc

37
Q

Describe how virtualization works

A

@TODO

38
Q

Describe the differences between AES ECB and CBC

A

Advanced Encryption Standard (AES) is a block cipher.

Electronic Code Book (ECB) has the same output for any block of identical input, meaning some amount of information about the structure of encrypted data can be observed from the ciphertext. It is also weak against chosen plaintext attacks.

Cipher Block Chaining (CBC) mode uses an IV and chained XORs to fix the weaknesses of ECB.

39
Q

Describe PKI

A

Public Key Infrastructure

Trust-based system; individuals/organizations generate public/private key pairs. Then a certificate is created by a Certificate Authority (CA) containing the pubkey and identity metadata. The CA signs the certificate. The cert then serves as proof of identity for the person/org.

Revocation:
-Certificate Revocation Lists (CRL):
–CAs publish CRLs containing certs that have been revoked by that CA before their scheduled expiration date.
–Weakness: Requires client to be online and/or have the latest CRLs

-Online Certificate Status Protocol (OCSP):
–Network protocol where client sends certificate identifier to an “OSCP responder” (server), who returns revocation information about the cert.
–Weakness: More online-reliant than CRLs, but uses less network data. Also OSCP is unencrypted and therefor useless for TLS cert verification because MitM inherently allows intercepting OCSP traffic.

-OCSP Stapling:
–TLS Certificate Status Request extension
–When server cert is presented in TLS handshake, a time-stamped OCSP response (signed by the CA) is included, eliminating need for clients to contact the CA.
–OCSP Must-Staple: A flag set by the CA in the server certificate they generate. Instructs clients that the cert must be served with a valid OCSP response or the connection should be terminated.

Public key cryptography is a cryptographic technique that enables entities to securely communicate on an insecure public network, and reliably verify the identity of an entity via digital signatures. Public keys are generally in X.509 format.

A public key infrastructure (PKI) is a system for the creation, storage, and distribution of digital certificates which are used to verify that a particular public key belongs to a certain entity. The PKI creates digital certificates which map public keys to entities, securely stores these certificates in a central repository and revokes them if needed. A PKI consists of:

-Certificate authority (CA) that stores, issues and signs the digital certificates
-Registration authority (RA) which verifies the identity of entities requesting their digital certificates to be stored at the CA
-Central directory - i.e., a secure location in which keys are stored and indexed
-Certificate management system managing things like the access to stored certificates or the delivery of the certificates to be issued
-Certificate policy stating the PKI’s requirements concerning its procedures. Its purpose is to allow outsiders to analyze the PKI’s trustworthiness

40
Q

What is CI/CD?

A

Continuous integration and continuous delivery/deployment

-CI/CD bridges the gaps between development and operation teams by enforcing automation in building, testing, and deployment of applications

-Modern DevOps practices usually involve CI/CD

41
Q

Explain DNS

A

Domain Name System (generally over UDP port 53)

DNS lookup:
-Check browser cache
-Check system hosts file
-Check system cache
-Check remote DNS server:
–Check root (e.g., “.”) nameserver (returns IP or next name server)
–Check TLD (e.g., “com”) nameserver (returns IP or next name server)
–Check organization’s/authoritative nameserver (returns IP)

Record types:
-Start of Authority (SOA): information stored in a DNS zone about that zone and about other DNS records
-A and AAAA: IP addresses
-MX: Mail server for a domain
-Name servers (NS)
-CNAME: Domain name aliases
-Pointers (PTR): for reverse DNS lookups

Attacks:
-DNS cache poisoning - insert bad records into DNS resolver cache by pretending to be an authoritative name server

Mitigations:
-DNSSEC (Domain Name System Security Extensions) - provides authentication and integrity but not availability/confidentiality

42
Q

Describe UDP:
-Overview
-Example protocols/uses

A

User Datagram Protocol (UDP): Connectionless, doesn’t care if the packets are received, no order maintained, no flow control. UDP is faster than TCP. Generally, UDP datagrams with bad checksums are dropped.

UDP datagram structure: source port, dest port, length, checksum, data

UDP examples: Video streaming, online games, DNS (generally), DHCP, NTP

43
Q

What are the three pillars of data security?

A

CIA Triad - Confidentiality, integrity, and availability

44
Q

What’s the difference between a certificate and a public key in the context of TLS/SSL?

A

Certificate contains the public key as well as identity metadata (issuer, usage, etc.) and (preferably) a signature from being signed by a CA private key

More info:
https://superuser.com/questions/620121/what-is-the-difference-between-a-certificate-and-a-key-with-respect-to-ssl

45
Q

Tell me about a time when you had to make a decision without all information you needed.

A

Good answer:

Dark Souls Overhaul, created omni-roll feature (widely requested), but wasn’t sure how the hardcore multiplayer fanbase would receive it. So I implemented it plus additional controls to disable the feature when the player was in PvP. This preserved the multiplayer meta-game while allowing more casual users to take advantage of the improved QoL feature.

Null answer:

I can’t recall such a situation from either my work or my personal life. Surely, it happened that I did not find all the information I needed, but in such a case I simply decided according to the information I managed to find. In my opinion this is the only reasonable way of making decisions.

46
Q

[Threat modeling] Describe STRIDE

A

STRIDE is a framework for how “to go from a [data flow] diagram to a set of threats”

-Microsoft STRIDE method:
–Spoofing - Authentication - Impersonating something or someone else
–Tampering - Integrity - Modifying data or code
–Repudiation - Non-repudiation - Claiming to have not performed an action
–Information Disclosure - Confidentiality - Exposing information to someone not authorized to see it
–Denial of Service - Availability - Deny or degrade service to users
–Elevation of Privilege - Authorization - Gain capabilities without proper authorization

More info:
https://www.microsoft.com/security/blog/2007/09/11/stride-chart/

47
Q

[Threat modeling] Describe the Cyber Kill Chain

A

Cyber Kill Chain is a cybersecurity framework from Lockheed Martin: https://www.lockheedmartin.com/en-us/capabilities/cyber/cyber-kill-chain.html

It’s part of their Intelligence Driven Defense model and aims to give a high-level overview of APT methodology.

APT methodology steps:
-Reconnaissance
-Weaponization
-Delivery
-Exploitation
-Installation
-Command & Control (C2)
-Actions on objectives

48
Q

Describe SELinux and how it complements UNIX permissions (more generally, explain DAC vs MAC)

A

Basic Linux security controls have users, groups, ownership, and file permissions. You can specify which users can read/write/execute files based on the owner and the group that the file belongs to. This is an example of discretionary access control (DAC) - access control is generally set by the owner of a particular resource.

SELinux is an example of mandatory access control (MAC) - enforced by policy and not easily overridden by users. SELinux is based on roles, actions, and entities (files, users, etc.). SELinux policy dictates which roles can perform which actions on which entities.

49
Q

Explain CORS

A

Cross-Origin Resource Sharing (CORS)

Origin: URI scheme, domain, and port

With Same-origin policy (SOP), content at one URL can only access content at another URL with the same Origin. The SOP allows embedding of images via the <img></img> tag, and JavaScript includes with the tag. However, while these external resources can be loaded by the page, any JavaScript on the page won’t be able to read the contents of these resources (with some exceptions). TL;DR: SOP generally allows a domain to issue requests to other domains, but not to access the responses.

SOP benefit: Protect from XSS, etc. by avoiding sending cookies and other sensitive data to a malicious host.

SOP and cookies: An HTTP cookie is a piece of data that a server sends to the user’s web browser. The browser may store it and send it back with later requests to the same server. Due to legacy requirements, cookies are often accessible from all subdomains of a site even though each subdomain is technically a different origin. Using the HttpOnly cookie flag can partially mitigate risks from this behavior.

CORS is a relaxation of the SOP.

Access-Control-Allow-Origin (ACAO): Servers can use this response header to specify origins that are allowed to access its content. A wildcard (*) can be used, but not as part of a domain.

Access-Control-Allow-Credentials: Servers can use this response header (with value true) to allow requests to be passed with cookies, the Authorization header, etc.

You can not use a combination of “Access-Control-Allow-Origin: *” and “Access-Control-Allow-Credentials: true”, but some servers dynamically generate the Access-Control-Allow-Origin header based on the client Origin header (this is considered bad practice).

The HTTP OPTIONS method is used to determine what methods and headers are allowed when interacting across origins.

Insecure CORS configurations:
-Dynamically-generated ACAO headers using client Origin header as input
-Allowing null origin
-Trusting a vulnerable domain could facilitate XSS
-Trusting a non-TLS (HTTP) origin can facilitate MitM

50
Q

Explain the two most common OAuth grant types

A

Authorization code:
-Client requests path: /authorization
–Common params: client_id, redirect_uri, response_type (“code”), scope, state
-User is redirected to login (Facebook, Steam, etc.)
-Browser is redirected to path /callback on the client (from redirect_uri) with the code as a URL parameter
-Client “server” receives auth code and posts it to /token on the OAuth service
-Server responds with the token
-Subsequent API calls contain the token in the “Authorization” header

Implicit grant:
-Client requests path /authorization
–But with response_type “token”
-User is redirected to login (Facebook, Steam, etc.)
-Browser is redirected to path /callback on the client (from redirect_uri) with the token as a URL parameter
-Subsequent API calls contain the token in the “Authorization” header

Further reading:
https://portswigger.net/web-security/oauth/grant-types
https://developer.okta.com/blog/2019/08/22/okta-authjs-pkce

51
Q

Describe IPsec

A

IPsec is a suite of network protocols for authenticating and encrypting packets over an IP network. It is primarily used for VPNs.

Architecture:
-Internet Security Association and Key Management Protocol (ISAKMP): Used to configure ciphers & key exchange
-Authentication Headers (AH): Provides connectionless data integrity and data origin authentication for IP datagrams (but not confidentiality?)
-Encapsulating Security Payloads (ESP): Provides confidentiality, connectionless data integrity, data origin authentication, an anti-replay service

Modes:
-Transport Mode: Only the payload of the IP packet is encrypted/authenticated
-Tunnel Mode: Entire IP packet is encrypted and authenticated. It is then encapsulated into a new IP packet with a new IP header. Tunnel mode is used to create virtual private networks.

@TODO:
https://en.wikipedia.org/wiki/IPsec
https://www.youtube.com/watch?v=CuxyZiSCSfc

52
Q

Describe CSP

A

Content Security Policy (CSP)

Primary goal: mitigate XSS.

By using the Content-Security-Policy response header, the server can limit sources for JS (and other resources) and whether a page can be framed by other pages (e.g., in an iframe).

53
Q

Describe PFS

A

Perfect Forward Secrecy (PFS)

Forward secrecy protects past sessions against future compromises of keys or passwords. The value of forward secrecy is that it protects past communication.

Example: Using key exchange to securely agree on an ephemeral session key for every new message sent.

54
Q

Explain SSRF

A

Server-side Request Forgery (SSRF)

When an attacker causes a server to make a request of the attacker’s choosing. This can facilitate access to restricted content on the server itself (e.g., admin login), internal networks, or other third-party servers.