Computer Security and Penetration Testing: Trojan Horses
Computer Security and Penetration Testing: Trojan Horses
Testing
Chapter 10
Trojan Horses
Objectives
• Outline the evolution of the Trojan horse
• Name ways in which Trojans are deployed
• Identify risks associated with Trojans
• Trojan horse
– Application that uses trickery to get a user to install it
– Circumvents safety measures inherent in an operating
system
• That might make it difficult for a covert installation to
operate
• Distribution vectors:
– E-mail attachments
– Scripts in HTML e-mails
– Files on FTP servers
– Scripts on spoofed Web sites
– Scripts on hacked legitimate Web sites
– Download opportunities on Web sites
– Files offered on bulletin boards and forums
– Social engineering
Chapter 11
Denial-of-Service Attacks
Objectives
Define a denial-of-service (DoS) attack
Describe causes of DoS attacks
Describe several varieties of DoS attacks
Some major network defects and vulnerabilities
Vulnerability of the network architecture
Vulnerability of a specific server system architecture (Intel
x86, AMD Opteron, etc.)
Defects and bugs in the operating system or software
Holes present within system security
Some vulnerabilities cannot be closed by patching
Because there is an inherent bandwidth limit
See Figure 11-1
X axis = Flood attacks or software attacks
Y axis = Isolated attacks or distributed attacks
Z axis =Voluntary or involuntary, on the part of the systems
administrator
Sending Connection Requests
Target or victim receives a large quantity of connection
requests
Attacker is probably using a spoofed IP address
Consuming Bandwidth
All of a network’s available bandwidth is consumed by
sending a large number of packets
Using Your Own Resources
Hacker uses forged UDP packets to connect the echo service
on one computer
To a service on another computer
Response for this packet will automatically be sent to the
computer whose IP address the hacker is using
Consuming Other’s Resources
Hacker may be able to consume data structures
Simply writing a program or a script that replicates itself
Hackers also attempt to consume disk space
By using any feature that allows data to be written to a
system’s hard disk
Hacker may be able to lock an account by executing a certain
number of failed attempts to log in
Exploit the existing software weaknesses
Effect is either degraded performance or crashes on the victim
server
Hackers generate a small number of carefully malformed
packets to exploit known software bugs
Bugs allow hackers to change or damage configuration files
Ping of Death
A historical DoS attack in which the hacker uses the Ping
utility to acquire access to a system
Hacker sends a packet larger than 64 KB to the target
computer
Target system may crash or restart
Most legitimate Ping utilities do not allow you to send a ping
of more than 64 KB
You can use Apsend to send an oversized packet
Ping of Death (continued)
You can block pings on your firewall
Almost all operating systems have been patched to deflect
this attack
DNS Service Attack
Domain Name Service (DNS)
Database that maps domain names to IP addresses
Two kinds of attacks are related to the DNS service: DNS
spoofing and DNS overflow
Other software attacks include
Teardrop
Land
Charge
Comes from a single source
It is easily countered by blocking traffic from that source
Come from multiple concurrent sources
Much more difficult to block with ACLs or firewall rules
Distributed denial-of-service, or DDoS, attack
Depends on the hacker’s ability to compromise information
on a large number of systems
May require hundreds or thousands of compromised hosts to
make a DDoS attack successful
Special tools used to attack a computer
The process of DDoS is fully automated
DDoS attack occurs in the following sequence:
Hacker identifies vulnerable hosts (100 or more)
Hacker gets access to these hosts after they are compromised
Hacker installs the tool needed to attack each host
Hacker uses the compromised hosts for future attacks
Chapter 12
Buffer Overflows
Objectives
Describe buffer overflow
List types of buffer overflows
Identify techniques used to cause a buffer overflow
Comprehend techniques used to detect buffer overflow
conditions
Understand methods used in preventing buffer overflows
Buffer overflow
Condition common to structured programming languages
such as the “C” language
Happens when input applied to a variable is larger than the
memory allotted to that variable
When an attacker sends input in excess of the expected range of
the value
The target system will either crash or execute the malicious
code sent by the attacker
• main function
Entry point to the detailed code in the application
Responsible for calling other functions
Each of which executes a particular task, and may call other
functions in turn
Functions use variables to store values that may be stored
temporarily or permanently
Once a function has completed, the program control returns to
the calling or invoking function
Buffer overflows can be divided into two categories: stack
overflow and heap overflow
Programs use a memory stack area to store values for variables
Stack is intended to ensure that there is sufficient memory
space for all functions to operate
Occasionally the stack is insufficient to complete the functions
and an error is generated
Stack stores details regarding the function that called the
currently executing function
Information can be lost after the stack is corrupted
A heap is similar to a stack
Provides memory to the application various functions
Provides a permanent memory space
Data stored in a heap can be used throughout various functions
and commands
A heap is randomly accessed because it stores values statically
Size of a heap usually grows as new variables’ values are
introduced
Heap overflow is known as the corruption of the instruction
pointer
Instruction pointer points to the memory area where the
function to be executed is stored
Uses the characters that are read differently by the computer
and acquire larger space
Additional bytes of data may cause the input value to exceed
the memory limitation of the variable
Applicable to situations in which the user specifies a value
from an HTML page
Becomes a weakness whenever a back-end script reads the code
And, after expanding the value, results in a buffer overflow
Size of the stack is computer-dependent
Buffer overflow may not happen until a value that exceeds the
stack size is specified
Buffer overflow may occur when verification for the length of
the input value is made at the client-side
And the back-end script accepts it without performing checks
Double validation
Indicates to potential hackers that buffer overflow exploits are
not possible on your Web site
Compression of data that is passed as input value to variables of
the function that might be overflowed
Method uses the buffer in a more efficient manner with a higher
amount of data
Focus is to minimize code size
So hackers can double the amount of code in buffer
Identify the functions and variables that can lead to buffer
overflows
Check the reaction of the application whenever a large set of
character data is supplied to a variable
Function may include length verification
And thus return an error message if the data exceeds the
expected size
Can be a painstaking, tedious process
Because all variables that accept values must be checked
Precaution should be taken to ensure that the input data is
provided in the correct format
For interactive Web pages
Consider that the hidden data is also a part of the input that is
given to the string
When specifying the input data
It is important to check that no NULL characters (empty
fields) are being passed
After a buffer overflow exploit has been detected
The probability of its existence in other applications by the
same vendor is higher
Bug is typically fixed by programming the functions to perform
an input validity check
Providing a null terminator will prevent the buffer overflow
even
If additional values have been specified
Consider developing specific programming guideline policies
for your organization
Having, understanding, and applying secure-coding best
practices may not be entirely foolproof
Options are available to avoid the use of function calls that are
vulnerable to buffer overflows
Checks must be made to validate the input values in both the
new and old applications
Software can be installed to keep a continuous check on a
buffer overflow condition
Software must be updated with all available security patches