Lesson 15: Summarizing Secure Application Development Concepts Flashcards
software exploitation
- means an attack that targets a vulnerability in OS or application software
- applications such as web servers, web browsers, email clients, and databases are often targeted
- application vulnerability is a design flaw that can cause the application security system to be circumvented or that will cause the application to crash
zero-day exploit
- vulnerability that is exploited before the developer knows about it or can release a patch is called a zero-day exploit
- can be extremely destructive, as it can take the vendor a lot of time to develop a patch, leaving systems vulnerable for days, weeks, or even years
input validation attack
- passes invalid data to the application, and because the input handling on the routine is inadequate, it causes the application or even the OS to behave in an unexpected way
- attack types:
• Overflow—the attacker submits input that is larger than the variables assigned by the application to store it can cope with.
• Injection—the attacker embeds code within the input or appends code to it that executes when the server processes the submission.
arbitrary code
attacker may be able to use the exploit to obtain sufficient privileges to run whatever malware (or arbitrary code) he or she chooses
buffer overflow vulnerability
- attacker passes data that deliberately overfills the buffer (an area of memory) that the application reserves to store the expected data
- three principal exploits:
• Stack overflow—the stack is an area of memory used by a program subroutine. It includes a return address, which is the location of the program that called the subroutine. An attacker could use a buffer overflow to change the return address, allowing the attacker to run arbitrary code on the system - Heap overflow—a heap is an area of memory allocated by the application during execution to store a variable of some sort. A heap overflow can overwrite those variables, with unexpected effects. An example is a known vulnerability in Microsoft’s GDI+ processing of JPEG images
- Array index overflow—an array is a type of variable designed to store multiple values. It is possible to exploit unsecure code to load the array with more values than it expects, creating an exception that could be exploited
integer overflow attack
- causes the target software to calculate a value that exceeds these bounds
- could also be used where the software is calculating a buffer size; if the attacker is able to make the buffer smaller than it should be, he or she may then be able to launch a buffer overflow attack
race conditions
- occur when the outcome from execution processes is directly dependent on the order and timing of certain events, and those events fail to execute in the order and timing intended by the developer
- race condition vulnerability is typically found where multiple threads are attempting to write a variable or object at the same memory location
- race conditions have been used as an anti-virus evasion technique
pointer
- reference to an object at a particular memory location
- attempting to access that memory address is called dereferencing
- pointer has been set to a null value (perhaps by some malicious process altering the execution environment), this creates a null pointer type of exception and the process will crash. Programmers can use logic statements to test that a pointer is not null before trying to use it
memory leaks
particularly serious in service/background applications, as they will continue to consume memory over an extended period. Memory leaks in the OS kernel are also extremely serious. A memory leak may itself be a sign of a malicious or corrupted process
Dynamic Link Library (DLL)
- binary package that implements some sort of standard functionality, such as establishing a network connection or performing cryptography
- main process of a software application is likely to load (or call) several DLLs during the normal course of operations
DLL injection
- not a vulnerability of an application but of the way the operating system allows one process to attach to another
- functionality can be abused by malware to force a legitimate process to load a malicious link library
- link library will contain whatever functions the malware author wants to be able to run
- malware uses this technique to move from one host process to another to avoid detection
refactoring
means that the code performs the same function by using different methods (control blocks, variable types, and so on)
shim
- code library that intercepts and redirects calls to enable legacy mode functionality is called a shim
- shim must be added to the registry and its files (packed in a shim database/.SDB file) added to the system folder
arbitrary code execution
purpose of the attacks against application or coding vulnerabilities is to allow the attacker to run his or her own code on the system
remote code execution
- code is transmitted from one machine to another
- code would typically be designed to install some sort of Trojan or to disable the system in some way (Denial of Service)
privilege escalation
- Vertical privilege escalation (or elevation) is where a user or application can access functionality or data that should not be available to them. For instance, a user might have been originally assigned read-only access (or even no access) to certain files, but after vertical escalation, the user can edit or even delete the files in question.
- Horizontal privilege escalation is where a user accesses functionality or data that is intended for another user. For instance, a user might have the means to access another user’s online bank account.
SQL injection attack
- attempts to insert an SQL query as part of user input
- attack can either exploit poor input validation or unpatched vulnerabilities in the database application
- if successful, this could allow the attacker to extract or insert information into the database or execute arbitrary code on the remote system using the same privileges as the database application
directory traversal
- another common input validation attack
- attacker submits a request for a file outside the web server’s root directory by using the command to navigate to the parent directory (../). This attack can succeed if the input is not filtered properly and access permissions on the file are the same as those on the web server root.
- command injection attack attempts to run OS shell commands from the browser | as with directory traversal, the web server should normally be able to prevent commands from operating outside of the server’s directory root and to prevent commands from running with any other privilege level than the web “guest” user (who is normally granted only very restricted privileges). A successful command injection attack would find some way of circumventing this security (or find a web server that is not properly configured).
transitive access
- describes the problem of authorizing a request for a service that depends on an intermediate service
- Designing the trust relationships between these three parties is complicated:
- The merchant site could impersonate the end user to obtain publisher site services fraudulently.
- The end user could exploit weaknesses in the merchant site to obtain unauthorized services from the publisher site.
Cross-Site Scripting (XSS)
- one of the most powerful input validation exploits
- attack described is a reflected or non-persistent XSS attack
- stored (or persistent) XSS attack aims to insert code into a back-end database used by the trusted site.
- typical attack would proceed as follows:
1. The attacker identifies an input validation vulnerability in the trusted site.
2. The attacker crafts a URL to perform a code injection against the trusted site. This could be coded in a link from the attacker’s site to the trusted site or a link in an email message.
3. When the user clicks the link, the trusted site returns a page containing the malicious code injected by the attacker. As the browser is likely to be configured to allow the site to run scripts, the malicious code will execute.
4. The malicious code could be used to deface the trusted site (by adding any sort of arbitrary HTML code), steal data from the user’s cookies, try to intercept information entered into a form, or try to install malware. The crucial point is that the malicious code runs in the client’s browser with the same permission level as the trusted site.
Document Object Model (DOM)
client-side scripts use the Document Object Model (DOM) to modify the content and layout of a web page. For example, the “document.write” method enables a page to take some user input and modify the page accordingly. An attacker could submit a malicious script as input and have the page execute the script. Such exploits can be very powerful as they run with the logged in user’s privileges of the local system.
cookie
- various mechanisms have been used to preserve this sort of stateful information
- created when the server sends an HTTP response header with the cookie
- cookies are either non-persistent (or session) cookies, in which case they are stored in memory and deleted when the browser instance is closed, or persistent, in which case they are stored on the hard drive until deleted by the user or pass a defined expiration date
- replaying–Session IDs are often generated using predictable patterns (such as IP address with the date and time), making the session vulnerable to eavesdropping and possibly hijacking, by replaying the cookie to re-establish the session
Cross-Site Request Forgery (XSRF)
- exploit applications that use cookies to authenticate users and track sessions
- to work, the attacker must convince the victim to start a session with the target site. The attacker must then pass an HTTP request to the victim’s browser that spoofs an action on the target site
- confused deputy attack–if the target site assumes that the browser is authenticated because there is a valid session cookie and doesn’t complete any additional authorization process on the attacker’s input (or if the attacker is able to spoof the authorization), it will accept the input as genuine