Defensive Coding Practices – Concepts and Techniques Flashcards
Input validation is the verification process that ensures the data that is supplied for processing is …
of the correct data type and format; falls within the expected and allowed range of values; is not interpreted as code as is the case with injection attacks; does not masquerade in alternate forms that bypass security controls.
Canonicalization (or C14N) is the process of …
converting data that has more than one possible representation to conform to a standard canonical form.
Sanitization is the process of …
converting something that is considered dangerous into its innocuous form. Both inputs and outputs can be sanitized.
Input sanitization is the process of …
transforming the data that is supplied by the user before it is processed. Methods are Stripping, Substitution, Literalization.
What are the two of the most basic and effective protection mechanisms that can be used to mitigate a lot
of software attacks?
Input validation and output error handling importance.
Clipping level is the tolerance of …
user errors which are inevitable, permitting a pre-determined number of user errors before recording it as a security violation.
Threat modeling should identify API as …
potential entry points; banned and deprecated APIs that are susceptible to security breaches should be avoided and replaced with secure counterparts.
The Locality of Reference, also known as the principle of the locality, is the principle that subsequent data locations that are referenced when a program is run are often …
predictable and in proximity to previous locations based on time or space.
Dangling pointers are those pointers that … These occur when the object that the pointer was originally referencing was …
do not point to a valid object of the appropriate type in memory; deleted or de-allocated without the pointer value being modified.
The wild pointers are used prior to …
being initialized but they have been known to result in similar erratic, unpredictable, and dangerous results as dangling pointers.
From Wild pointers and Dangling pointers, attackers can take advantage and initiate …
overflow attacks.
A memory leak occurs when …
the memory buffer object that is allocated to hold some variable becomes unreachable.
The main goal of garbage collection is to …
reduce memory leaks i.e., reclaiming unreachable memory objects.
ARC
Automatic Reference Counting - a way of garbage collection wherein each object in memory keeps a count of the number of pointer references to it. Each time a reference to the object is made, the reference count is incremented. Whenever, a reference to the object is destroyed, then the reference count is decremented.
Fast death attack frequently subjecting the garbage collector to go into …
overdrive in its function resulting in the system coming to a halt.
Slow death attack is when the attacker requests …
additional memory that the garbage collector has to invoke, but they do so at a rate that is not quite as severe to throw an out-of-memory exception. In slow death, the CPU cycles are stolen, when memory is being occupied.
Type safety is an important consideration when choosing between a managed and unmanaged programming language. Type-safe code cannot access memory at …
arbitrary locations out of the range of memory address space that belongs to the object’s publicly exposed fields, it prevents Buffer overflow vulnerabilities.
CAS
Code access security (CAS) prevents code from untrustworthy sources or unknown origins from having run time permissions to perform privileged operations.
In addition to type safety, CAS concepts include the following …
Syntax Security (Declarative and Imperative); Security Actions; Secure Class Libraries.
Exceptions are software issues that are not
handled explicitly when the software behaves in an unintended or unreliable manner.
In Exception Management, all exceptions must be …
explicitly handled in order to avoid disclosing the entire exception stack. This can result in information disclosure potentially revealing the software’s internal architectural details and in some cases even the data value.
Safe Security Exception Handler (/SAFESEH) flag in systems that support it is an important exception management feature that can be leveraged during the …
compilation and linking process.
In a Session hijacking attacks, an attacker …
impersonates the identity of a valid user and interjects themselves into the middle of an existing session, routing information from the user to the system and from the system to the user through them.
When a session is hijacked, it can lead to …
information disclosure (confidentiality threat), alteration (integrity threat), or a denial of service (availability threat).
Session management is a security concept that aims at …
mitigating session hijacking or MITM attacks; it requires that the session is unique by the issuance of unique session tokens and it also requires that user activity is tracked so that someone who is attempting to hijack a valid session is prevented from doing so.