Common Software Vulnerabilities and Controls Flashcards
What are the vulnerability databases and tracking systems?
National Vulnerability Database (NVD); US Computer Emergency Response Team (CERT) Vulnerability Notes Database; Open Source Vulnerability Database; Common Vulnerabilities and Exposures (CVE); OWASP Top 10; Common Weakness Enumeration (CWE™)
NVD
National Vulnerability Database includes security checklists, security-related software flaws, misconfigurations of products, products affected, and impact metrics.
CERT
US Computer Emergency Response Team (CERT) Vulnerability Notes Database - In software that is being developed, they focus on vulnerability discovery, and in software that is already deployed, on vulnerability remediation.
Open Source Vulnerability Database is an independent and open source database that is created by and for …
the security community, with the goal of providing accurate, detailed, current, and unbiased technical information on security vulnerabilities.
CVE
The Common Vulnerabilities and Exposures is a dictionary of publicly known information security vulnerabilities and exposures. It is free for use and international in scope.
CWE
The Common Weakness Enumeration provides a common language for describing architectural, design, or coding software security weaknesses.
The CWE/SANS top 25 lists of most dangerous programming errors fall into the following three categories:
Insecure interaction between components; Risky resource management; Porous defenses.
Injection flaws, such as SQL, OS, and LDAP injection, occur when …
untrusted data is sent to an interpreter as part of a command or query. The attacker’s hostile data can trick the interpreter into executing unintended commands or accessing unauthorized data.
Broken Authentication and Session Management compromises the application functions related to authentication and session management that are often not implemented correctly, allowing attackers to …
compromise passwords, keys, session tokens, or exploit implementation flaws to assume other users’ identities.
Cross-Site Scripting (XSS) flaws occur whenever an application takes …
untrusted data and sends it to a web browser without proper validation and escaping. XSS allows attackers to execute script in the victim’s browser which can hijack user sessions, deface web sites, or redirect the user to malicious sites.
A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, or database key.
Insecure Direct Object References occur because …
without an access control check or other protection, attackers can manipulate these references to access unauthorized data.
Security Misconfiguration can be avoided by …
having a secure configuration defined for the application, framework, web server, application server, and platform; all these settings should be defined, implemented, and maintained as many are not shipped with secure defaults.
Many web applications do not properly protect sensitive data at rest or when it is in motion. In order to avoid Sensitive Data Exposure, appropriate protection mechanisms shall be implemented such as … in addition, When transport layer protection is limited only to certain operations like authentication and end-to-end transport layer protection is absent, …
encryption/hashing or secure transport; sensitive information can be intercepted and disclosed.
Missing Function Level
XXXXXXXXXXX
When resources are requested by the browser, virtually all web applications validate resource requests for access rights by verifying function level access rights, prior to serving up that request to the User Interface (UI). One kind of well-known check is the check of the Uniform Resource Locator (URL) access rights check, which the web application performs before rendering protected links and buttons. When web applications fail to perform access control checks attackers will be able to forge requests and URLs to access these unauthorized functionality and pages.
Cross-Site Request Forgery (CSRF) attack forces a logged-on victim’s browser to send …
a forged HTTP request, including the victim’s session cookie and any other authentication information, to a vulnerable web application. This allows the attacker to force the victim’s browser to generate requests the vulnerable application thinks are legitimate requests from the victim.
Using Components (libraries, frameworks, and other software modules) with Known Vulnerabilities almost run with full privilege. So, if exploited, they can cause …
serious data loss or server takeover; applications using these vulnerable components may undermine their defenses and enable a range of possible attacks and impacts.
Web applications frequently redirect and forward users to other pages and websites, and use untrusted data to determine the destination pages.
Unvalidated Redirects and Forwards occur when web applications do not perform …
proper validation, attackers can redirect victims to phishing or malware sites, or use forwards to access unauthorized pages.
A buffer overflow is a condition that occurs when …
data that is being copied into the buffer (contiguous allocated storage space in memory) is more than what the buffer can handle.
EIP
Execution Instruction Counter (EIP) is used to maintain the sequence order of functions indicating the address of the next instruction to be executed.
Stack overflow
If a malicious user manages to overwrite the return address (RET) to point to an address space in memory, where an exploit code (also known as payload) has been injected, then upon the completion of a function, the overwritten return address will be loaded into the EIP register, and program execution will be overflowed, potentially executing the malicious payload.
Which are the Unsafe functions that may lead to memory overflow?
strcpy() and strcat(), since they do not intrinsically perform length checks before copying data into the memory buffer.
Heap overflow
Heap overflows does not necessarily overflow but corrupts the heap memory space (buffer), overwriting variables and function pointers on the heap.
Heap corruption can cause …
serious side effects including denial of service and exploit code execution and protection mechanisms must not be ignored.
What are the reasons that can be attributed to causing buffer overflows?
Copying of data into the buffer without checking the size of input; Accessing the buffer with incorrect length values; Improper validation of array index; Integer overflows or wraparound; Incorrect calculation of buffer size before its allocation.
What are the defensive implementations of controls in code to avoid memory overflow?
Input size validation; double-checking buffer size to ensure that the buffer is sufficiently large to handle the input data copied into it; checking buffer boundaries to make sure that the functions in a loop don’t attempt to write past the allocated space; and performing integer type (size, precision, signed/unsigned) checks to make sure that they are within the expected range and values.
What are the other controls to avoid memory overflow in requirements, architectural, build/compile, and operations controls?
Choose a programming language that performs its own memory management and is type-safe; Use a proven and tested library or framework that include safer string manipulation functions (e.g. Safe C); Replace deprecated, insecure, and banned API functions that are susceptible to overflow issues with safer alternatives that perform
size checks before performing its operations; …
Injection Flaws occurs when an attacker …
supplies data that is accepted as is and interpreted as a command or part of a command, thus allowing the attacker to execute commands using an injection vector.
How injection flaws can be discoverable?
Using code review and scanners, including fuzzing scans, can be employed to detect them.
SQL Injection is when an attacker exploits …
the way in which database queries are constructed, the supply input becomes part of the (Structured Query Language) query that the database processes as a command.
The attack flow in SQL Injection is comprised of the following steps:
1) Exploration by hypothesizing SQL queries to determine if the software is susceptible to SQL injection; 2) Experimenting to enumerate internal database schema by forcing database errors; 3) Exploiting the SQL injection vulnerability to bypass checks or modify, add, retrieve or delete data from the database.
Blind SQL injection is when …
instead of using information from error messages to facilitate SQL injection, the attacker constructs simple Boolean SQL expressions (true/false questions) to iteratively probe the target database; depending on whether the query was successfully executed or not, the attacker can determine the syntax and structure of the injection.
OS Command Injection is when the software …
allows the execution of Operation System (OS) level commands using the supplied user input without sanitization or validation.
LDAP (Lightweight Directory Access Protocol) Injection is when …
unsanitized and unvalidated input is used to construct or modify syntax, contents, and commands that are executed as an LDAP query.
XML Injection occurs when the software …
does not properly filter or quote special characters or reserved words that are used in XML, allowing an attacker to modify the syntax, contents, or commands before execution. Two main types are XPATH injection and XQuery injection.
In XPATH injection, the XPath expression that is used to retrieve data from the XML data store is …
not validated or sanitized prior to processing and built dynamically using user-supplied input.; an attacker can take advantage of this weakness by injecting malformed XML expressions, allowing the attacker to perform malicious operations such as modifying and controlling logic flow, retrieving unauthorized data and/or circumventing authentication checks.
The consequences of injection flaws are varied and serious such as:
disclosure, alteration, or destruction of data; compromise of the Operating System; discovery of the internal structure (or schema) of the database or data store; enumeration of user accounts from a directory store; circumventing nested firewalls; bypassing authentication; execution of extended procedures and privileged commands.
Mitigation and prevention strategies and controls for injection flaws that are commonly employed are …
consider all input to be untrusted and validate all user input; Encode output using the appropriate character set, escape special characters and quote input, besides disallowing meta-characters; Use structured mechanisms to separate data from code; avoid dynamic query construction; User parameterized queries; Display generic error messages that yield minimal to no additional information; Implement the least privilege by using views, and restricting tables, queries and procedures to only the authorized set of users and/or accounts.
Mitigate strategies to avoid the OS command injection are …
run the code in a sandbox environment that enforces strict boundaries between the processes being executed and the Operating System.
Implement defenses against LDAP injection attacks are …
filter or quote LDAP syntax from user-controlled input.