Secure Software Development Flashcards
SDLC
Software Development Life Cycle:
An organized process of developing a secure application throughout the life of the project
SDLC Phases
Planning, Requirements, Design, Build, Document, Test, Deploy, Maintain
Agile
Software development is performed in time-boxed or small increments to allow more adaptivity to change
DevOps
Software development and information technology operations
SDLC Principles: Defense in Depth
Layering of security controls is more effective and secure than relying on a single control
SDLC Principles: Never Trust User Input
Any input that is received from a user should undergo input validation prior to allowing it to be utilized by an application
SDLC Principles: Minimize Attack Surface
Reduce the amount of code used by a program, eliminate unneeded functionality, and require authentication prior to running additional plugins
SDLC Principles: Create Secure Defaults
the systems we design should default to a secure mode if we don’t do anything else
SDLC Principles: Authenticity & Integrity
Applications should be deployed using code signing to ensure the program is not changed inadvertently or maliciously prior to delivery to an end user
SDLC Principles: Fail Securely
Applications should be coded to properly conduct error handling for exceptions in order to fail securely instead of crashing
SDLC Principles: Rely on Trusted SDKs
SDKs must come from trusted source to ensure no malicious code is being added
Black-box Testing
Occurs when a tester is not provided with any information about the system or program prior to conducting the test
White-box Testing
allows testers to inspect and verify the inner workings of a software system (code, infrastructure…) and is provided full details of a system including the source code, diagrams, and user credentials in order to conduct the test
Gray-box Testing
(Combination of Black & White-box)
The tester partially understands the application’s internal working structure
Structured Exception Handling (SEH)
Structured Exception Handling:
Provides control over what the application should do when faced with a runtime or syntax error
Input Validation
Applications verify that information received from a user/client matches a specific format or range of values
preventing malformed data from persisting in the database and triggering malfunction of various downstream components
Static Analysis
Static analysis is the testing and evaluation of an application by examining the code without executing the application
Dynamic Analysis
Dynamic analysis is the testing and evaluation of an application during runtime
Fuzzing
Vulnerability testing technique
Send random amount of data in application, p.e. if it requires name, type in novel.
in an attempt to find system failures, memory leaks, error handling issues, and improper input validation
could be start of what could hackers build on, p.e. DoS attack
Backdoors
Code placed in computer programs to bypass normal authentication and other security mechanisms
Backdoors are a poor coding practice and should not be utilized
Directory Traversal
type of HTTP exploit that is used by attackers to gain unauthorized access to restricted directories and files
In some cases, an attacker might be able to write to arbitrary files on the server, allowing them to modify application data or behavior, and ultimately take full control of the server.
Arbitrary Code Execution
Occurs when an attacker is able to execute or run commands on a victim computer (not remotely)
Remote Code Execution - RCE
Occurs when an attacker is able to execute or run commands on a remote computer
Buffer Overflow
Occurs when a process stores data outside the memory range allocated by the developer
Buffer has allocated memory, p.e. 500 characters. If you give it 600 characters, it overruns other part of memory that is not buffer anymore. Thus, memory trys to always go back to characters that overwrote buffer bc they are in Stack.
Buffer
A temporary storage area that a program uses to store data
Over 85% of data breaches were caused by a buffer overflow
Stack
Reserved area of memory where the program saves the return address when a function call instruction is received
“Smash the Stack”
Occurs when an attacker fills up the buffer with NOP so that the return address may hit a NOP and continue on until it finds the attacker’s code to run
Address Space Layout Randomization
Method used by programmers to randomly arrange the different address spaces used by a program or process to prevent buffer overflow exploits
Cross-Site Scripting (XSS), 3 Types
Occurs when an attacker embeds malicious scripting commands on a trusted website
Stored/Persistent
Attempts to get data provided by the attacker to be saved on the web server by the victim
Isn’t just reflected, data is stored in DB/Server then sent to the user from where it’s stored
Injects anyone that views the content (ex: if Youtube allowed JS in comments)
Reflected
Attempts to have a non-persistent effect activated by a victim clicking a link on the site
Input (JS) is reflected back into the response
DOM-based
Attempt to exploit the victim’s web browser
User’s input lands inside a dangerous part of JS code (happens on client-side)
Prevent XSS with output encoding and proper input validation
Cross-Site Request Forgery (XSRF/CSRF)
Cross-Site Request Forgery:
Occurs when an attacker forces a user to execute actions on a web server for which they are logged in.
Example: You’re loged in to your bank account. Attacker uses Social E. to send you an email (an action embedded in a hyperlink p.e.). If you click on it, and bc you´re already authenticated, the action, p.e. transferring 100 Euro, is executed.
SQL Injection
Attack consisting of the insertion or injection of an SQL query via input data from the client to a web application
SQL injection is prevented through input validation and using least privilege when accessing a database
If you see ` OR 1=1; on the exam, it’s an SQL injection
Injection Attack
Insertion of additional information or code through data input from a client to an application
SQL
HTML
XML
LDAP
Most common type is an SQL injection
XML / XML Vulnerabilities
XML (Extensible Markup Language) is a markup language similar to HTML, but without predefined tags to use
XML data submitted without encryption or input validation is vulnerable to spoofing, request forgery, and injection of arbitrary code
XML Bomb (Billion Laughs Attack)
XML encodes entities that expand to exponential sizes, consuming memory on the host and potentially crashing it
XML Eternal Entity (XXE)
An attack that embeds a request for a local resource
To prevent XML vulnerabilities from being exploited, use proper input validation
Race Conditions
when two computer program processes, or threads, attempt to access the same resource at the same time and cause problems in the system
A race condition vulnerability is found where multiple threads are attempting to write a variable or object at the same memory location
Race Conditions: Dereferencing
A software vulnerability that occurs when the code attempts to remove the relationship between a pointer and the thing it points to.
Race conditions are difficult to detect and mitigate
Race conditions can also be used against databases and file systems
Time of Check to Time of Use (TOCTTOU)
a resource is checked for a particular value, such as whether a file exists or not, and that value then changes before the resource is used
Preventing Race Conditions/TOCTTOU
Develop applications to not process things sequentially if possible
Implement a locking mechanism to provide app with exclusive access
Design Vulnerabilities: Insecure Components
Any code that is used or invoked outside the main program development process
Code Reuse
Third-party Library
Software Development Kit (SDK)
Design Vulnerabilities: Insufficient Logging/Monitoring
Any program that does not properly record or log detailed enough information for an analyst to perform their job
Logging and monitoring must support your use case and answer who, what, when, where, and how
Design Vulnerabilities: Weak of Default Configurations
Any program that uses ineffective credentials or configurations, or one in which the defaults have not be changed for security
Many applications choose to simply run as root or as a local admin
Permissions may be too permissive on files or directories due to weak configurations
Utilize scripted installations and baseline configuration templates to secure applications during installation
LDAP Injections
LDAP typically stores authentication info (user/pass)
Attacker makes malformed queries to pull more info than they’re supposed to (or to bypass authentication)
Usually via URLs or input fields
Example:
Normal Query
http://www.CVexample.com/people_search.aspx?name=Sam)(zone=public)
Manipulated Query
http://www.CVexample.com/people_search.aspx?name=Sam)(zone=*)
SSL Stripping/HTTP Downgrade
Combines an on-path with a downgrade attack (attacker sits between client/server)
Attacker modifies data between victim & web server
Done via: Proxy server, ARP spoofing, or rogue AP
Dead Code
Section of source code of a program which is executed but whose result is never used in any other computation.
Add security vulnerability
OWASP
Open Web Application Security Project:
An online community that produces freely-available articles, methodologies, documentation, tools, and technologies in the field of web application security