Lesson 14 Secure App Conecpts Flashcards
TOCTOU
Time of Check/Time of Use
Race condition
CSRF (or XSRF, same) Cross Site Request Forgery
Client Side or Cross Site Request Forgery
- exploit applications that use cookies to authenticate users and track sessions
attacker gains control of the session cookie by tricking the victim to start session with target while previously signed in to the trusted target
SSRF Server Side Request Forgeries
Server Side Request Forgeries exploit the lack of authentication between internal servers and services (implicit trust) and weak input validation
- allows the server to process arbitrary requests to target another service
- allows the attacker to submit unsanitized requests or API parameters
Session Hijacking
replaying a cookie in some way
attackers gain session cookies from sniffing on a public or unsecure network
Counter moves are to:
- encrypt cookies during transmission
- delete cookies from clients browser cache after session is completed
- deliver new cookie for each new session
Proper session management and token generation
- use non-predictable algorithm for token generation
- limit lifespan of a session
- require reauthentication after a certain period of time
API Attacks
App Programing Interface allow consumers to automate services on a web server and cloud services
Attackers exploit
- ineffective secrets management, allowing APi Keys to be discovered
- lack of input validation, unsanitized input
- error messages which give too much details about the system or network
- DoS by bombarding with spurious calls, protect through throttling/rate limiting mechanisms
Percent Encoding in a URL
Allows a user-agent to submit any safe or unsafe character to the server within a URL
% = %25 / = %2F \ = %5C < = %3C > = %3E = %20
replay attack
using a valid session token via sniffing or guessing to re-establish a web app session illegitimately
PtH attack
Pass the Hash attack
attack uses hashed password on protocols that allow hashed passwords for authentication
such as Server Message Block (SMB) or NTLM or Kerberos
good for horizontal movement
difficult attack to detect as it exploits valid network behavior
DLL injection
Dynamic Link Library injection
exploits the OS functionality of allowing one process to attach to another
malware can inject a malicious library and then force a process to load it
Indicators:
- opening of unexpected network connections
- interacting with files and the registry in a suspicious manner
DoS
Denial of Service
attack causing the system or service to be temporarily or permanently unavailable
-send a bombardment of spurious calls to an api
- mitigate through throttling/rate-limiting mechanisms
SSL Stripping or HTTP Downgrade
- Combines a down grade attack with a man in the middle attack
- Effectively the attacker is a proxy, setting up a secure HTTP path with the server, while using an HTTP non-secure connection with the victim.
- Victim then sends credentials in the clear to the MitM who then uses the secure channel to the server
Mitigation:
- Instruct browsers not to use http
- Instruct Servers not to respond to http requests, only https requests
Memory Leak
an attack that causes a device to to run out of memory (resource exhaustion) causing system instability or crash
- can lead to a DoS
- starting sessions but not letting them complete causing state tables to fill
- resource exhaustion can lead to conditions for privilege escalation
race condition
a condition where a service attempts to perform two operations at nearly the same time, but due to the nature of the system must be done in the correct order
can lead to a DoS or other instability
can lead to a null pointer dereference causing a app to crash
Shimming
Creating or modifying a DLL, driver, or API to get an app to act in a malicious way
A type of DDL injection attack
Attacks a feature of Windows which allows for apps to run as if on legacy Window OSs
Refactoring
rewriting code to perform same function but using different new methods
Malware uses to change it’s signature to avoid AV sw detection
Normalization
A form of input validation
strips illegal characters from input and converted to the acceptable values prior to being entered into or processed by the database
Execution Control
Allow list
Block list
Execution control is a process of determining what additional sw or scripts may be installed or run on a host beyond its baseline
Allow list
- a list of allowable processes and scripts
- highly restrictive and can impede immediate needs/fixes
Block list
- a list of processes and scripts which can not be executed on the host
- it is permissive but vulnerable to sw which has not previously been identified as malicious
LAMP
LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is a very common example of a web service stack, after its four original components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language.
Application Attacks
application vulnerabilities is a design flaw allowing security to be circumvented
- Privileged Escalation
- Error handling
- Improper Input handling
Privilege Escalation
- allows for arbitrary code execution or even remote code execution
- Vertical Privilege Escalation allowing a user/app can access functionality or data not available to them
- Horizontal Privilege Escalation a user gains access to functionality or data intended for another user
Indictor:
- User or app running with higher than expected privileges
Error handling uses in app attacks
App attacks can cause errors in an attempt to glean more system details
An app should not divulge too much system information when an error occurs, such as type and configuration of a database server
Improper Input Handling
Most app attacks work by passing invalid or maliciously constructed data to the vulnerable process
Developers should always test for valid inputs
Usually described as overflow or injection type attacks
Overflow app attack
Attacker submits input which is too large to be stored in the variable assigned by the application
Indicators
- unexplained crashes
- error messages following a download
- execution of a new app or script
- connection to new hardware
Common attack types:
- buffer overflow
- integer overflow
Buffer Overflow
An attacker passes data to over fill the buffer of the stack, an area of memory used by a an application
The attacker can changed the return address or add code to execute a script (arbitrary code execution)
Stack Overflow
A stack is an area of memory used by a program sub routine which includes a return address of the program which called the subroutine.
Attacker can use a buffer overflow to change the return address to call malicious code instead of returning to the calling routine.
Integer Overflow
Attacker causes the target application to exceed the bounds defined by an integer to change the value from positive to negative.
Attacker could also attempt to make the buffer smaller in order allow a buffer overflow attack