45
Midterm In a Week In MHP 105, same time as our class Reading list is online Sample midterm is online o Try to solve it before the next class

Midterm In a Week

  • Upload
    alexa

  • View
    39

  • Download
    0

Embed Size (px)

DESCRIPTION

Midterm In a Week. In MHP 105, same time as our class Reading list is online Sample midterm is online Try to solve it before the next class . Summary From the Last Lecture. Reconnaissance: DNS split-horizon Scanning Ping sweep, TCP SYN sweep Traceroute Port scanning NATs - PowerPoint PPT Presentation

Citation preview

Page 1: Midterm In a Week

Midterm In a WeekIn MHP 105, same time as our classReading list is onlineSample midterm is onlineoTry to solve it before the next class

Page 2: Midterm In a Week

Reconnaissance:o DNS split-horizon

Scanningo Ping sweep, TCP SYN sweepo Tracerouteo Port scanningo NATso OS fingerprintingo Firewalking

Summary From the Last Lecture

Page 3: Midterm In a Week

Phase 3: Gaining Access Exploit vulnerabilitieso Exploits for a specific vulnerability can be

downloaded from hacker siteso Skilled hackers write new exploits

What is a vulnerability?What is an exploit?

Page 4: Midterm In a Week

Stack-Based Overflow Attacks Stack stores important data on procedure

call

Function callarguments

Return address

Saved frame ptr

Local variablesfor called procedure

TOS

Memory addressincreases

Page 5: Midterm In a Week

Stack-Based Overflow Attacks Consider a function

void sample_function(char* s){

char buffer[10];strcpy(buffer, s);return;

} And a main program

void main(){

int i;char temp[200];for(i=0; i<200;i++) temp[i]=‘A’;sample_function(temp);return;

}

Argument is largerthan we expected

Page 6: Midterm In a Week

Stack-Based Overflow Attacks Large input will be stored on the stack,

overwriting system information

Function callarguments

Return address

Saved frame ptr

s,buffer[10]TOS

Memory addressincreasesOverwritten

by A’s

Page 7: Midterm In a Week

Stack-Based Overflow Attacks Attacker overwrites return address to

point somewhere elseo “Local variables” portion of the stacko Places attack code in machine language at

that portiono Since it is difficult to know exact address of

the portion, pads attack code with NOPs before and after

Page 8: Midterm In a Week

Stack-Based Overflow Attacks Intrusion Detection Systems (IDSs) could

look for sequence of NOPs to spot buffer overflowso Attacker uses polymorphism: he transforms

the code so that NOP is changed into some other command that does the same thing, e.g. MOV R1, R1

o Attacker XORs important commands with a key

o Attacker places XOR command and the key just before the encrypted attack code. XOR command is also obscured

Page 9: Midterm In a Week

Stack-Based Overflow Attacks What type of commands does the

attacker execute?o Commands that help him gain access to the

machineo Writes a string into inetd.conf file to start shell

application listening on a port, then “logs on” through that port

o Starts Xterm

Page 10: Midterm In a Week

Stack-Based Overflow Attacks How does an attacker discover stack-

based overflow?o Looks at the source codeo Runs application on his machine, tries to

supply long inputs and looks at system registers

Read more ato http://insecure.org/stf/smashstack.html

Page 11: Midterm In a Week

Defenses Against Stack-Based Overflows

For system administrators:o Apply patches, keep systems up-to-dateo Disable execution from the stacko Monitor writes on the stacko Store return address somewhere elseo Monitor outgoing traffic

For software designerso Apply checks for buffer overflowso Use safe functions

Page 12: Midterm In a Week

Network Attacks Sniffing for passwords and usernames Spoofing addresses Hijacking a session

Page 13: Midterm In a Week

Sniffing Looking at raw packet information on the

wireo Some media is more prone to sniffing –

Etherneto Some network topologies are more prone to

sniffing – hub vs. switch

Page 14: Midterm In a Week

Sniffing On a Hub Ethernet is a broadcast media – every

machine connected to it can hear all the informationo Passive sniffing

For X For X

X

A

RY

Page 15: Midterm In a Week

Sniffing On a Hub Attacker can get anything that is not

encrypted and is sent to LANo Defense: encrypt all sensitive traffico Tcpdump

http://www.tcpdump.orgo Snort

http://www.snort.orgo Ethereal

http://www.ethereal.com

Page 16: Midterm In a Week

Sniffing On a Switch Switch is connected by a separate

physical line to every machine and it chooses only one line to send the message

For X

For X X

A

RY

Page 17: Midterm In a Week

Sniffing On a Switch – Take 1 Attacker sends a lot of ARP messages for

fake addresses to Ro Some switches send on all interfaces when

their table overloads

For X

For X X

A

RY

Page 18: Midterm In a Week

Sniffing On a Switch – Take 2 Address Resolution Protocol (ARP) maps

IP addresses with MAC addresses

1. For X

4. For X

2. Who has X?

3. I do X

A

RY

Page 19: Midterm In a Week

Sniffing On a Switch – Take 2 Attacker uses ARP poisoning to map his

MAC address to IP address X

3. For X, MAC (A)

1. I have X, MAC(A)

X

A

RY

4. For X, MAC (A)

2. I

have

Y, M

AC(A

)

6. For Y, MAC(A) 5. A sends this backto R, to be sent to MAC(X)

7. For Y, MAC (A

)

8. A sends this backto R, to be sent to MAC(Y)

Page 20: Midterm In a Week

Active Sniffing Tools Dsniffo http://www.monkey.org/~dugsong/dsniffo Also parses application packets

for a lot of applicationso Sniffs and spoofs DNS Dangerous

Page 21: Midterm In a Week

Spoofing DNS Attacker sniffs DNS requests, replies with

his own address faster than real server (DNS cache poisoning)

When real reply arrives client ignores it This can be coupled with man-in-the-

middle attack on HTTPS and SSH

Page 22: Midterm In a Week

Sniffing Defenses Use end-to-end encryption Use switcheso Statically configure MAC and IP bindings with

ports Don’t accept suspicious certificates

Page 23: Midterm In a Week

What Is IP Spoofing Faking somebody else’s IP address in IP

source address field How to spoof?o Linux and BSD OS have functions that enable

superuser to create custom packets and fill in any information

o Windows XP also has this capability but earlier Windows versions don’t

Page 24: Midterm In a Week

IP Address Spoofing in TCP packets

Attacker cannot see reply packets

Alice M Bob M

Attacker M1. SYN, IP Alice, SEQA

2. SYN SEQB, ACK SEQA

3. RESET

Page 25: Midterm In a Week

Guessing a Sequence Number Attacker wants to assume Alice’s identityo He establishes many connections to Bob with

his own identity gets a few sequence numbers

o He disables Alice (DDoS)o He sends SYN to Bob, Bob replies to Alice,

attacker uses guessed value of SEQB to complete connection – TCP session hijacking

o If Bob and Alice have trust relationship (/etc/hosts.equiv file in Linux) he has just gained access to Bob

o He can add his machine to /etc/hosts.equivecho “1.2.3.4” >> /etc/hosts.equiv

Page 26: Midterm In a Week

Guessing a Sequence Number It used to be ISN=f(Time), still is in some

Windows versions

Page 27: Midterm In a Week

Guessing a Sequence Number On Linux ISN=f(time)+rand

Page 28: Midterm In a Week

Guessing a Sequence Number On BSD ISN=rand

Page 29: Midterm In a Week

Spoofing Defenses Ingress and egress filtering Prohibit source routing option Don’t use trust models with IP addresses Randomize sequence numbers

Page 30: Midterm In a Week

At The End of Gaining Access Attacker has successfully logged onto a

machine

Page 31: Midterm In a Week

Phase 4: Maintaining Access Attacker establishes a listening

application on a port (backdoor) so he can log on any time with or without a password

Attackers frequently close security holes they find

Page 32: Midterm In a Week

Netcat Tool Similar to Linux cat commando http://netcat.sourceforge.net/o Client: Initiates connection to any port on

remote machineo Server: Listens on any porto To open a shell on a victim machine

On victim machine: nc –l –p 1234/* This opens a backdoor */

On attacker machine: nc 123.32.34.54 1234 –c /bin/sh/* This enters through a backdoor, opens a shell */

Dangerous

Page 33: Midterm In a Week

Netcat Tool Used for o Port scanningo Backdooro Relaying the attack

Page 34: Midterm In a Week

Trojans Application that claims to do one thing

(and looks like it) but it also does something malicious

Users download Trojans from Internet (thinking they are downloading a free game) or get them as greeting cards in E-mail, or as ActiveX controls when they visit a Web site

Trojans can scramble your machineo They can also open a backdoor on your

system They will also report successful infection

to the attacker

Page 35: Midterm In a Week

Back Orifice Trojan application that cano Log keystrokeso Steal passwordso Create dialog boxeso Mess with files, processes or system (registry)o Redirect packetso Set up backdoorso Take over screen and keyboardo http://www.bo2k.com/

Dangerous

Page 36: Midterm In a Week

Trojan Defenses Antivirus software Don’t download suspicious software Check MD5 sum on trusted software you

download Disable automatic execution of

attachments

Page 37: Midterm In a Week

At the End of Maintaining Access The attacker has opened a backdoor and

can now access victim machine at any time

Page 38: Midterm In a Week

Phase 5: Covering Tracks Rootkits Alter logs Create hard-to-spot files Use covert channels

Page 39: Midterm In a Week

Application Rootkits Alter or replace system components

(for instance DLLs) E.g., on Linux attacker replaces ls program Rootkits frequently come together with

sniffers:o Capture a few characters of all sessions on the

Ethernet and write into a file to steal passwords

o Administrator would notice an interface in promiscuous mode Not if attacker modifies an application that shows

interfaces - netstat

Page 40: Midterm In a Week

Application Rootkits Attacker will modify all key system

applications that could reveal his presenceo List processes e.g. pso List files e.g. lso Show open ports e.g. netstato Show system utilization e.g. top

He will also substitute modification date with the one in the past

Page 41: Midterm In a Week

Defenses Against App. Rootkits

Don’t let attackers gain root access Use integrity checking of files:o Carry a floppy with md5sum, check hashes of

system files against hashes advertised on vendor site or hashes you stored before

Use Tripwireo Free integrity checker that saves md5 sums of

all important files in a secure database (read only CD), then verifies them periodically

o http://www.tripwire.org/

Page 42: Midterm In a Week

Kernel Rootkits Replace system callso Intercept calls to open one application with

calls to open another, of attacker’s choosingo Now even checksums don’t help as attacker

did not modify any system applicationso You won’t even see attacker’s files in file listingo You won’t see some processes or open ports

Usually installed as kernel modules Defenses: disable kernel modules

Page 43: Midterm In a Week

Altering Logs For binary logs:o Stop logging serviceso Load files into memory, change themo Restart logging serviceo Or use special tool

For text logs simply change file through scripts

Change login and event logs, command history file, last login data

Page 44: Midterm In a Week

Defenses Against Altering Logs

Use separate log serverso Machines will send their log messages to these

servers Encrypt log files Make log files append only Save logs on write-once media

Page 45: Midterm In a Week

Creating Hard-to-Spot Files Names could look like system file names,

but slightly changedo Start with .o Start with . and add spaceso Make files hidden

Defenses: intrusion detection systems and caution