Program Security
Program Security
Program Security
By Prof. Krishna Samdani
SECURE PROGRAMS
2
Fixing Faults
■ Software that has many faults early on is likely to have many others
still waiting to be found.
■ The test was considered as proof: if the system withstood the attacks, it
was considered secure.
■ Often patch efforts made system less secure because they introduce
new faults frequently, there are four reasons why:
3
Fixing Faults
■ Pressure to repair encourages a narrow focus on the fault and not its
context.
■ Intentional
○ Malicious
○ Non-malicious
■ Inadvertent
○ Validation error (incomplete / inconsistent): permission checks
○ Domain error: controlled access to data
○ Serialization and aliasing: program flow order
○ Inadequate identification and authentication: basis for
authorization
○ Boundary condition violation: failure on first or last case
○ Other exploitable logic errors
6
NON-MALICIOUS PROGRAM ERRORS
7
NON-MALICIOUS PROGRAM ERRORS – Buffer Overflow
Example:
char sample[10];
for (i=0; i<=9; i++)
sample[i] = ‘A’;
sample[10]=‘B’
All programs and data are in memory during execution, sharing space with the OS,
other code.
There are 4 cases to consider in deciding where ‘B’ goes.
■ Buffer may overflow into (and change):
○ User’s own data space
○ User’s program area
○ System data space
○ System program area
9
NON-MALICIOUS PROGRAM ERRORS – Buffer Overflow
User’s Data
Memory A A A A A A A A A A B
User’s Program
User’s Data code
Memory A A A A A A A A A A B
Memory A A A A A A A A A A B
System Program
User’s Data code
Memory A A A A A A A A A A B
■ Computer Virus can slow down your computer by displaying useless messages.
Virus Code that attaches to another program and copies itself to other programs.
• Transient virus – life depends on life of its host
• Resident virus – locates inside memory
Trojan Horse malicious effect is hidden from user (Ex: login script)
Logic viruses triggered by an event and goes off when specific condition occur
Time viruses triggered by a time or date
Trapdoor (backdoor) feature that allows access to program other than through normal channels
Worm program that spreads copies of itself through a network, can be stand alone program
Rabbit virus/worm that self-replicates without bound. Overtime, so many copies of Rabbit
would be running that it would clog the system, making it run slow and making it
more difficult to remove the program.
News 2012: SpyEye Trojan Horse
■ Crimeware steals passwords from your browser
■ Cyber criminals use your debit card details to drain your account
■ When you visit your banking site, it adjusts figures so the criminal
transactions don't appear
■ Attack has been used in U.S. and UK
NEWS 2015: DUUZER – A new Backdoor targeting South Korean Organizations
■ Security researchers at Symantec have uncovered a new Backdoor Trojan that grants
hackers remote access and some control over infected machines.
■ "Duuzer," as dubbed by the researchers, has been targeting organizations in South
Korea and elsewhere in an attempt to steal valuable information.
■ The Trojan is designed to infect both 32-bit and 64-bit computers running Windows 7,
Windows Vista, and Windows XP.
■ Duuzer gives attackers remote access to the compromised computer, allowing them to:
○ Collect system and drive information
○ Access, modify and delete files
○ Upload and Download additional files
○ Execute malicious commands
○ Steal data from infected system
NEWS 2015: DUUZER – A new Backdoor targeting South Korean Organizations
■ According to Symantec Researchers, the most obvious routes are Spear Phishing
campaigns and Watering Hole attacks.
■ Once infected, Duuzer checks if the system is running on a virtual machine like VMWare
or Virtual Box to ensure that security researchers are not analyzing the malware before
performing its malicious routines.
■ Duuzer's first sets up a backdoor on the machine, allowing attackers physical access to
the system.
■ The attackers then manually run commands through the backdoor on affected
computers. They can perform a variety of operations mentioned above.
HOW VIRUSES ATTACH
■ It is hard to detect.
■ It is not easily destroyed or deactivated.
■ It spreads infection widely.
■ It can reinfect its home program or other programs.
■ It is easy to create.
■ It is machine independent and operating system independent
TYPES OF VIRUSES
■ Some parts of the operating system and most user programs execute,
terminate, and disappear, with their space in memory being available
for anything executed later.
■ For very frequently used parts of the operating system and for a few
specialized user programs, it would take too long to reload the
program each time it is needed.
■ Such code remains in memory and is called "resident" code.
■ Virus writers like to attach viruses to resident code because the
resident code is activated many times while the machine is running.
Each time the resident code runs, the virus does too.
DOCUMENT VIRUSES
■ A virus writer may want a virus to do several things at the same time,
namely, spread infection, avoid detection, and cause harm.
■ Unfortunately, many of these behaviours are perfectly normal and
might otherwise go undetected. For instance, one goal is modifying the
file directory; many normal programs create files, delete files, and
write to storage media. Thus, there are no key signals that point to the
presence of a virus.
Virus effect How it is caused
Attach to executable program Modify file directory
Write to executable program file
Attach to data or control file Modify directory, rewrite data, append to data, append data
to self
Remain in memory Intercept interrupt by modifying interrupt handler address
table
Load self in nontransient memory area
Infect disks Intercept interrupt
Intercept OS call (eg., to format disk)
Modify system file
Modify ordinary executable program
Conceal self Intercept system calls that would reveal self and falsify result
Spread infection Infect boot sector, infect systems program,
Infect ordinary program
Infect data ordinary program reads to control its execution
Prevent deactivation Activate before deactivating program and block deactivation
Store copy to38reinfect after deactivation
TRANSMISSION PATTERNS
61
Thanks!
Any questions?
62
63