2.3 Memory Injections Flashcards

1
Q

Finding malware

A

Malware runs in memory
– Memory forensics can find the malicious code
* Memory contains running processes
– DLLs (Dynamic Link Libraries)
– Threads
– Buffers
– Memory management functions
– And much more
* Malware is hidden somewhere
– Malware runs in its own process
– Malware injects itself into a legitimate process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Memory injection

A

Add code into the memory of an existing process
– Hide malware inside of the process
* Get access to the data in that process
– And the same rights and permissions
– Perform a privilege escalation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DLL injection

A

Dynamic-Link Library
– A Windows library containing code and data
– Many applications can use this library
* Attackers inject a path to a malicious DLL
– Runs as part of the target process
* One of the most popular memory injection methods
– Relatively easy to implement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Buffer overflows

A

Overwriting a buffer of memory
– Spills over into other memory areas
* Developers need to perform bounds checking
– The attackers spend a lot of time looking for openings
* Not a simple exploit
– Takes time to avoid crashing things
– Takes time to make it do what you want
* A really useful buffer overflow is repeatable
– Which means that a system can be compromised

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Race condition

A

A programming conundrum
– Sometimes, things happen at the same time
– This can be bad if you’ve not planned for it
* Time-of-check to time-of-use attack (TOCTOU)
– Check the system
– When do you use the results of your last check?
– Something might happen between the check and the use

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Race condition example

A

Two bank accounts with $100
– User 1 and User 2 transfer $50 from Account A to Account B
– Expected outcome:
Account A has $50, Account B has $150 (or A has $0 and B has $200)
* What if you don’t perform proper validation?
– User 1 and User 2 check the account balances ($100 in each account)
– User 1 transfers $50 from Account A (now at $50) to Account B (now at $150)
– At about the same time, user 2 transfers $50 from Account A
(still has $100, right?, so now at $50) to Account B (now at $200)
– Outcome: Account A has $50, Account B has $200

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Race conditions can cause big problems

A

January 2004 - Mars rover “Spirit”
– Reboot when a problem is identified
– Problem is with the file system, so reboot
because of the file system problem
– Reboot loop was the result
* Pwn2Own Vancouver 2023 - Tesla Model 3
– TOCTOU attack against the
– Tesla infotainment using Bluetooth
– Elevated privileges to root
– Earned $100,000 US prize and
they keep the Tesla

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Software updates

A

Always keep your operating system and applications
updated
– Updates often include bug fixes and security patches
* This process has its own security concerns
– Not every update is equally secure
* Follow best practices
– Always have a known-good backup
– Install from trusted sources
– Did I mention the backup?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Downloading and updating

A

Install updates from a downloaded file
– Always consider your actions
– Every installation could potentially be malicious
* Confirm the source
– A random pop-up during web browsing may not
be legitimate
* Visit the developer’s site directly
– Don’t trust a random update button or random
downloaded file
* Many operating systems will only allow signed apps
– Don’t disable your security controls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Automatic updates

A

The app updates itself
– Often includes security checks / digital signatures
* Relatively trustworthy
– Comes directly from the developer
* Solarwinds Orion supply chain attack
– Reported in December 2020
– Attackers gained access to the Solarwinds
development system
– Added their own malicious code to the updates
– Gained access to hundreds of government agencies
and companies

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Operating systems Vulnerabilities

A

A foundational computing platform
– Everyone has an operating system
– This makes the OS a very big target
* Remarkably complex
– Millions of lines of code
– More code means more opportunities for a security issue
* The vulnerabilities are already in there
– We’ve just not found them yet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A month of OS updates

A

A normal month of Windows updates
– Patch Tuesday - 2nd Tuesday of each month
– Other companies have similar schedules
* May 9, 2023 - Nearly 50 security patches
– 8 Elevation of Privilege Vulnerabilities
– 4 Security Feature Bypass Vulnerabilities
– 12 Remote Code Execution Vulnerabilities
– 8 Information Disclosure Vulnerabilities
– 5 Denial of Service Vulnerabilities
– 1 Spoofing Vulnerability
* https://msrc.microsoft.com/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Best practices for OS vulnerabilities

A

Always update
– Monthly or on-demand updates
– It’s a race between you and the attackers
* May require testing before deployment
– A patch might break something else
* May require a reboot
– Save all data
* Have a fallback plan
– Where’s that backup?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Code injection

A

Code injection
– Adding your own information into a data stream
* Enabled because of bad programming
– The application should properly handle input
and output
* So many different data types
– HTML, SQL, XML, LDAP, etc.

An example of website code:
– “SELECT * FROM users WHERE name = ‘“ + userName + “’”;
* How this looks to the SQL database:
– “SELECT * FROM users WHERE name = ‘Professor’”;
* Add more information to the query:
– “SELECT * FROM users WHERE name = ‘Professor’ OR ‘1’ = ‘1’”;
* This could be very bad
– View all database information, delete database information, add users, denial of service, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SQL injection

A

SQL - Structured Query Language
– The most common relational database management
system language
* SQL injection (SQLi)
– Put your own SQL requests into an existing application
– Your application shouldn’t allow this
* Can often be executed in a web browser
– Inject in a form or field

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Cross-site scripting

A

XSS
– Cascading Style Sheets (CSS) are
something else entirely
* Originally called cross-site because of browser
security flaws
– Information from one site could be shared with another
* One of the most common web app vulnerabilities
– Takes advantage of the trust a user has for a site
– Complex and varied
* XSS commonly uses JavaScript
– Do you allow scripts? Me too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Non-persistent (reflected) XSS attack

A

Web site allows scripts to run in user input
– Search box is a common source
* Attacker emails a link that takes advantage of
this vulnerability
– Runs a script that sends credentials/
session IDs/cookies to the attacker
* Script embedded in URL executes in the victim’s browser
– As if it came from the server
* Attacker uses credentials/session IDs/cookies to steal
victim’s information without their knowledge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Persistent (stored) XSS attack

A

Attacker posts a message to a social network
– Includes the malicious payload
* It’s now “persistent”
– Everyone gets the payload
* No specific target
– All viewers to the page
* For social networking, this can spread quickly
– Everyone who views the message can
have it posted to their page
– Where someone else can view it and propagate it
further…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Hacking a Subaru

A

June 2017, Aaron Guzman
– Security researcher
* When authenticating with Subaru, users get a token
– This token never expires (bad!)
* A valid token allowed any service request
– Even adding your email address to someone else’s
account
– Now you have full access to someone else’s car
* Web front-end included an XSS vulnerability
– A user clicks a malicious link, and you have their token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Protecting against XSS

A

Be careful when clicking untrusted links
– Never blindly click in your email inbox. Never.
* Consider disabling JavaScript
– Or control with an extension
– This offers limited protection
* Keep your browser and applications updated
– Avoid the nasty browser vulnerabilities
* Validate input
– Don’t allow users to add their own scripts
to an input field

21
Q

Hardware vulnerabilities

A

We are surrounded by hardware devices
– Many do not have an accessible operating system
* These devices are potential security issues
– A perfect entry point for an attack
* Everything is connecting to the network
– Light bulbs, garage doors, refrigerators, door locks
– IoT is everywhere
* The security landscape has grown
– Time to change your approach

22
Q

Firmware

A

The software inside of the hardware
– The operating system of the hardware device
* Vendors are the only ones who can fix their hardware
– Assuming they know about the problem
– And care about fixing it
* Trane Comfortlink II thermostats
– Control the temperature from your phone
– Trane notified of three vulnerabilities in April 2014
– Two patched in April 2015, one in January 2016

23
Q

End-of-life

A

End of life (EOL)
– Manufacturer stops selling a product
– May continue supporting the product
– Important for security patches and updates
* End of service life (EOSL)
– Manufacturer stops selling a product
– Support is no longer available for the product
– No ongoing security patches or updates
– May have a premium-cost support option
* Technology EOSL is a significant concern
– Security patches are part of normal operation

24
Q

Legacy platforms

A

Some devices remain installed for a long time
– Perhaps too long
* Legacy devices
– Older operating systems, applications, middleware
* May be running end-of-life software
– The risk needs to be compared to the return
* May require additional security protections
– Additional firewall rules
– IPS signatures for older operating systems

25
Q

Virtualization security

A

Quite different than non-virtual machines
– Can appear anywhere
* Quantity of resources vary between VMs
– CPU, memory, storage
* Many similarities to physical machines
– Complexity adds opportunity for the attackers
* Virtualization vulnerabilities
– Local privilege escalations
– Command injection
– Information disclosure

26
Q

VM escape protection

A

The virtual machine is self-contained
– There’s no way out
– Or is there?
* Virtual machine escape
– Break out of the VM and interact with the host
operating system or hardware
* Once you escape the VM, you have great control
– Control the host and control other guest VMs
* This would be a huge exploit
– Full control of the virtual world

27
Q

Escaping the VM

A

March 2017 - Pwn2Own competition
– Hacking contest
– You pwn it, you own it - along with some cash
* JavaScript engine bug in Microsoft Edge
– Code execution in the Edge sandbox
* Windows 10 kernel bug
– Compromise the guest operating system
* Hardware simulation bug in VMware
– Escape to the host
* Patches were released soon afterwards

28
Q

Resource reuse

A

The hypervisor manages the relationship between
physical and virtual resources
– Available RAM, storage space, CPU availability, etc.
* These resources can be reused between VMs
– Hypervisor host with 4 GB of RAM
– Supports three VMs with 2 GB of RAM each
– RAM is allocated and shared between VMs
* Data can inadvertently be shared between VMs
– Time to update the memory management features
– Security patches can mitigate the risk

29
Q

Security in the cloud

A

Cloud adoption has been nearly universal
– It’s difficult to find a company NOT using the cloud
* We’ve put sensitive data in the cloud
– The attackers would like this data
* We’re not putting in the right protections
– 76% of organizations aren’t using
– MFA for management console users
* Simple best-practices aren’t being used
– 63% of code in production are unpatched
– Vulnerabilities rated high or critical (CVSS >= 7.0)

30
Q

Attack the service

A

Denial of Service (DoS)
– A fundamental attack type
* Authentication bypass
– Take advantage of weak or faulty authentication
* Directory traversal
– Faulty configurations put data at risk
* Remote code execution
– Take advantage of unpatched systems
– Attack the application
* Web application attacks have increased
– Log4j and Spring Cloud Function
– Easy to exploit, rewards are extensive
* Cross-site scripting (XSS)
– Take advantage of poor input validation
* Out of bounds write
– Write to unauthorized memory areas
– Data corruption, crashing, or code execution
* SQL injection
– Get direct access to a database

31
Q

Supply chain risk

A

The chain contains many moving parts
– Raw materials, suppliers, manufacturers,
distributors, customers, consumers
* Attackers can infect any step along the way
– Infect different parts of the chain without suspicion
– People trust their suppliers
* One exploit can infect the entire chain
– There’s a lot at stake

32
Q

Service providers

A

You can control your own security posture
– You can’t always control a service provider
* Service providers often have access to internal services
– An opportunity for the attacker
* Many different types of providers
– Network, utility, office cleaning, payroll/accounting,
cloud services, system administration, etc.
* Consider ongoing security audits of all providers
– Should be included with the contract

33
Q

Target service provider attack

A

Target Corp. breach - November 2013
– 40 million credit cards stolen
* Heating and AC firm in Pennsylvania was infected
– Malware delivered in an email
– VPN credentials for HVAC techs was stolen
* HVAC vendor was the supplier
– Attackers used a wide-open Target network to infect
every cash register at 1,800 stores
* Do these technicians look like an IT security issue?

34
Q

Hardware providers

A

Can you trust your new server/router/switch/firewall/
software?
– Supply chain cyber security
* Use a small supplier base
– Tighter control of vendors
* Strict controls over policies and procedures
– Ensure proper security is in place
* Security should be part of the overall design
– There’s a limit to trust

35
Q

Cisco or not Cisco?

A

All network traffic flows through switches and routers
– A perfect visibility and pivot point
* July 2022 - DHS arrests reseller CEO
– Sold more than $1 billion of counterfeit Cisco products
– Created over 30 different companies
– Had been selling these since 2013
* Knock-offs made in China
– Sold as authentic Cisco products
– Until they started breaking and catching on fire

36
Q

Software providers

A

Trust is a foundation of security
– Every software installation questions our trust
* Initial installation
– Digital signature should be confirmed during
installation
* Updates and patches
– Some software updates are automatic
– How secure are the updates?
* Open source is not immune
– Compromising the source code itself

37
Q

Solarwinds supply chain attack

A

Solarwinds Orion
– Used by 18,000 customers
– Including Fortune 500 and US Federal Government
* Software updates compromised in March and June 2020
– Upgrades to existing installations
– Not detected until December 2020
* Additional breaches took advantage of the exploit
– Microsoft, Cisco, Intel, Deloitte
– Pentagon, Homeland Security, State Department,
Department of Energy, National Nuclear Security
Administration, Treasury

38
Q

Misconfiguration Vulnerabilities
Open permissions

A

Very easy to leave a door open
– The hackers will always find it
* Increasingly common with cloud storage
– Statistical chance of finding an open permission
* June 2017 - 14 million Verizon records exposed
– Third-party left an Amazon S3 data repository open
– Researcher found the data before anyone else
* Many, many other examples
– Secure your permissions!

39
Q

Unsecured admin accounts

A

The Linux root account
– The Windows Administrator or superuser account
* Can be a misconfiguration
– Intentionally configuring an easy-to-hack password
– 123456, ninja, football
* Disable direct login to the root account
– Use the su or sudo option
* Protect accounts with root or administrator access
– There should not be a lot of these

40
Q

Insecure protocols

A

Some protocols aren’t encrypted
– All traffic sent in the clear
– Telnet, FTP, SMTP, IMAP
* Verify with a packet capture
– View everything sent over the network
* Use the encrypted versions - SSH, SFTP, IMAPS, etc.

41
Q

Default settings

A

Every application and network device has a default login
– Not all of these are ever changed
* Mirai botnet
– Takes advantage of default configurations
– Takes over Internet of Things (IoT) devices
– 60+ default configurations
– Cameras, routers, doorbells, garage door openers, etc.
* Mirai released as open-source software
– There’s a lot more where that came from

42
Q

Open ports and services

A

Services will open ports
– It’s important to manage access
* Often managed with a firewall
– Manage traffic flows
– Allow or deny based on port number
or application
* Firewall rulesets can be complex
– It’s easy to make a mistake
* Always test and audit
– Double and triple check

43
Q

Mobile device security

A

Challenging to secure
– Often need additional security policies
and systems
* Relatively small
– Can be almost invisible
* Almost always in motion
– You never know where it might be
* Packed with sensitive data
– Personal and organizational
* Constantly connected to the Internet
– Nothing bad happens on the Internet

44
Q

Jailbreaking/rooting

A

Mobile devices are purpose-built systems
– You don’t have access to the operating system
* Gaining access
– Android - Rooting
– Apple iOS - Jailbreaking
* Install custom firmware
– Replaces the existing operating system
* Uncontrolled access
– Circumvent security features
– The MDM becomes relatively useless

45
Q

Sideloading

A

Malicious apps can be a significant security concern
– One Trojan horse can create a data breach
* Manage installation sources
– The global or local app store
* Jailbreaking circumvents security
– Sideloading
– Apps can be installed manually without using an app store
– An MDM becomes relatively useless

46
Q

Vulnerabilities

A

Many applications have vulnerabilities
– We’ve just not found them yet
* Someone is working hard to find the next big vulnerability
– The good guys share these with developers
* Attackers keep these yet-to-be-discovered holes to themselves
– They want to use these vulnerabilities for personal gain

47
Q

Zero-day attacks

A

Attackers search for unknown vulnerabilities
– They create exploits against these vulnerabilities
* The vendor has no idea the vulnerability exists
– They don’t have a fix for an unknown problem
* Zero-day attacks
– An attack without a patch or method of mitigation
– A race to exploit the vulnerability or create a patch
– Difficult to defend against the unknown
* Common Vulnerabilities and Exposures (CVE)
– https://cve.mitre.org/

48
Q

Zero-day attacks in the wild

A

April 2023 - Chrome zero-day
– Memory corruption, sandbox escape
* May 2023 - Microsoft zero-day patch
– Secure boot zero-day vulnerability
– Attacker can run UEFI-level self-signed code
* May 2023 - Apple iOS and iPadOS zero-days
– Three zero-day patches
– Sandbox escape, disclosure of sensitive
information, arbitrary code execution
– Active exploitations