foundations of network and computer securityjrblack/class/csci6268/f05/slides/csci6268l16.pdf•...

45
Foundations of Network and Foundations of Network and Computer Security Computer Security J John Black Lecture #16 Oct 25 th 2005 CSCI 6268/TLEN 5831, Fall 2005

Upload: others

Post on 19-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Foundations of Network and Foundations of Network and Computer SecurityComputer Security

JJohn Black

Lecture #16Oct 25th 2005

CSCI 6268/TLEN 5831, Fall 2005

Page 2: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Announcements• Project #1 is assigned

– See web page for description and cacert.pem– Due Thurs, Nov 3rd (distance students too!)– Note: Martin is out, Tomorrow thru Sunday next week

• Distance students:– I have all but one Quiz #2, but won’t be graded until next week

• Two more reading assignments on website– Both are a lot of fun to read

• Midterm #2 is Nov 8th (2.5 weeks from now)

Page 3: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Flash Viruses

• Viruses can spread very fast– SQL/Slammer had only a 376 byte code size– No pause between propagation attempts

• Reading assignment– Read “How to 0wn the Internet in your Spare Time”

• A real problem– If you reinstall an old OS and attempt to download

patches, you may be infected before you can patch!

Page 4: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Prevention• Stay patched

– windowsupdate.com– Linux patches (yum)

• Reduce network services to those needed– “Best block is not be there” – Mr. Miagi– Windows still comes with a ton of stuff turned on

• Getting better though!– SQL Slammer victims didn’t even know they were

running an SQL server!– netstat –a

• Might surprise you

Page 5: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Prevention (cont)

• Don’t open attachments unless you’re sure– Always run a virus scanner

http://www.colorado.edu/its/security/antivirus/– Even Word docs are dangerous

• Don’t visit questionable web sites– Esp if your browser is set to low security

levels– Javascript is evil

• Felton’s Javascript attack

Page 6: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Trojans

• Malicious code hidden within another object– Email attachments can contain trojans– This is how many viruses spread

• Backdoor is usually considered as a synonym– Putting a backdoor into login.c qualifies

Page 7: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Thompson’s Turing Award Lecture (1995)

• Thompson and Ritchie won the Turing award for creating Unix

• Thompson’s is my favorite Turing award lecture– “Reflections on Trusting Trust”– Please read it (it’s short)

• His lecture has three stages– Stage I: a “Quine”– A Quine is a program which outputs its own source

code

Page 8: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

A Quine in Cchar*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c"; main(){printf(f,34,f,34,10);}

• We printf the string f, inserting f into itself as a parameter– Yow!

• We could attach any extra code we like here

• File this away in your head for now: we can write a program which outputs its own source code

Page 9: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Thompson, Stage II

• Note that a C compiler is often written in C– Kind of strange chicken-and-egg problem– How to bootstrap

• Interesting “learning behavior”– You add a feature, compile compiler with

itself, then it “knows” the feature• Once you get a rudimentary compiler

written, it can be arbitrarily extended

Page 10: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Thompson, Stage III

• Add a backdoor to login.c– Allow valid passwords plus some “master” password– Note that this would be caught soon enough because

it exists in the login.c source code• Ok, so be sneakier

– Add code in cc.c (the C compiler) to add the backdoor to login.c whenever compiling login.c

– Add self-replicating code to the C compiler to reproduce itself plus the login.c backdoor!

Page 11: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Implementing the Trojan

• Now compile login.c – Compiler adds the backdoor

• Compile cc.c– Compiler sees that it’s compiling itself and self-

replicating code runs to ensure login.c trojan and cc.c trojan are compiled into cc binary

• Now remove all this new code from cc.c– Back door exists only in binary!– login.c and cc.c will continue to have trojan even after

infinite recompiles

Page 12: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Moral of the Story

• The amount of cleverness we haven’t even thought of yet is scary– We’re probably never going to have

completely secure computers and networks– The most we can hope for is “best effort” from

those we trust and from ourselves– It’s going to be an eternal battle between us

and the criminals

Page 13: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Denial of Service

• An old idea– Picket lines, blockades, doorbell ditch, false pizza

orders, prank phone calls, etc.

• First technological DoS I know of– Denver Taxi company in the 50’s– Promised a white driver every time– Civil rights protesters called and left phone off hook

• Tied up phone lines back then

Page 14: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

DoS (cont)

• In the computer arena– Mail bombs

• Large emails to fill up someone’s hard disk– Network traffic

• Lots of bogus traffic aimed at just overwhelming victim

• This is typically not TCP traffic– Why not?

Page 15: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Network-Based DoS

• Common methods– Large UDP packets

• Max size is 65,536 bytes• Will fragment over IP and all frags hit victim• Victim tries to reassemble IP fragments

– ICMP echo• Aka “ping”• Can also be large• (“Ping of death”)

Page 16: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

SYN Floods

• A TCP-based method– Normal TCP handshake starts with SYN from

client– Causes server to make an entry in the “SYN

queue” and use up some time– SYNs are very small, so attacker sends a ton

of them– A SYN at the server is called a “half-open

connection”• These eventually time out, but it takes a while

Page 17: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

First Attempted Remedy: Filtering

• Victim can try and filter out the IP source address of the attacker– This has to be done upstream or the victim’s

connection bandwidth is saturated• If ISP is willing to install a filter on the appropriate

source address, this works– But attacker can spoof source IP

• Attacker is not completing any TCP association, and wants to leave connections half-open

• This is almost always done

Page 18: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Reflection Attacks (aka “Smurfing”)

• Technique for amplifying traffic– Often works behind firewalls as well– Instead of flooding victim V with SYNs, we send SYNs

to hosts H1, H2, …, Hn and spoof the source address as V

• (Here n is large… say, 1000 or more)• Hosts send SYN/ACK to V• V is very confused and reacts in various ways• If hosts are behind firewall, it appears as though attack is

coming from local machines• Hosts are usually not overwhelmed, so they don’t feel the

attack

Page 19: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

DDoS: Distributed DoS

• Now, multiple attackers

Page 20: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

DDoS

• Most famous attack was in Feb 2000 against Amazon, Yahoo, eBay, and other major e-commerce sites

• Estimated losses of $1.2 billion US

• Easy for almost anyone to launch– Most of these, by the way, are hackers

attacking other hackers

Page 21: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Recruiting “Zombies”• A “Zombie” is a computer which has been

captured by the attacker– Typically by a virus or by just using some vulnerability

• Each infiltrated computer receives a hidden program from the “Zombie Master”

• The Zombie Master keeps a list of which computers he has control over

• When the time comes, he instructs all of his Zombies to simultaneously attack the victim computer

Page 22: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Case Study: The Gibson Story

• Who is Steve Gibson?– Owns Gibson Research Corp (grc)– Old time programmer– Self-proclaimed security expert– Writes tools in assembly (!)– Has taken on Microsoft for raw sockets in XP

• More on this later– Some don’t like him (www.grcsucks.com)

Page 23: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

The GRC Story

• Please read this article; it’s on our web page.

• It’s kind of wordy, but fun and informative reading.

Page 24: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

The Story

• At 8pm on Friday May 4th, 2001, grc.comdisappeared from the Internet

Page 25: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

DDoS Attack• T1 trunks are 1.54Mbit/sec• Verio has 100Mbit/sec connections to Internet• UDP traffic aimed at port 666

– Large packets which had fragmented into 1500-byte chunks

– Firewall discarded it, but still saturated T1’s– Need to filter at Verio’s end

Page 26: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Filtering

• After some calls, filtering is in place– Verio blocks UDP and ICMP

• Until Win2K and XP, it was difficult to send SYNs– Sending SYN’s would have been hard to block since this

would have meant shutting down all TCP connections, including http to grc.com

• Raw sockets in Win2K and XP mean that spoofing source IP is now possible, which also makes it harder to filter (as mentioned already)

Page 27: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Zombies• Gibson tracked 474 source addresses

sending the packets– All compromised windows machines– Most popular are cable-modem boxes

• Always on, high bandwidth

home.comrr.comaol.commediaone.netuu.netbtinternet.comshawcable.netoptonline.netne.jpchello.nlntl.comvideotron.caad.jppsi.netuk.com

1045120201714141414998776

Page 28: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Attacks Continue

• Attacker re-targets – First goes to IP of firewall

• This is different from the IP of the grc.com server• Verio shuts down ICMP and UDP to this IP as well

– Then goes to the Cisco router• Since it’s STILL on the grc side of the T1, it again

knocks grc.com off the network– How is the attacker getting these IP

addresses?• Traceroute

Page 29: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Size of the Attack

• Verio filtered 2.4 billion fragmented UDP datagrams headed for port 666– grc.com was completely unaware of the

attack– Filtering relied on being able to track source

IP addresses• Would not have worked if attacker had spoofed

source IP, which is commonly done nowadays

Page 30: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Meet the Attacker

• The attacker, it turns out, was 13– “Wicked” said he was attacking grc.com because

Gibson had allegedly referred to a friend as a “script kiddie”

– Gibson said he did not and asked the attacks to stop• They did for a while, but resumed

– Gibson tracked the IP to a town in Wisconsin, but needed Earthlink to cooperate to find the actual phone number

• They wouldn’t

Page 31: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

@Home

• Gibson tried to contact @home – Wanted to inform them of the 100+ users who

were compromised• And from which he was being attacked

– No useful response• They wanted the IPs, but wouldn’t let Gibson have

the zombie code, which he really wanted• Gibson refused to give up the IPs

Page 32: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

The Feds• Gibson calls the FBI

– Until $5,000 of damage had been done, no crime had even been committed.

– Secondly, they said that even if they did manage to meet the $5,000 minimum required for "Wicked's" activities to qualify as criminal, their staffs were overloaded and swamped with cases involving companies that had lost huge sums of money to Internet crime.

– Finally, they said that since "Wicked" was only 13 years old, nothing much would happen to him, even if the preponderance of evidence demonstrated that he was behind the attacks. They said that a couple of agents might go out to his home and have atalk with his parents, but in this country his youth was an impenetrable shield.

Page 33: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

The Feds (cont)

• Gibson gave the IPs to the Feds

• Gibson also noted that Wicked was in trouble at age 8, had computer removed until age 10, was monitored for 1 year and was now back at it

Page 34: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Gibson gets the Bot

• Bot was anonymously dropped into a mailbox– It was an IRC client

• Password-protected chat room• 100’s of other machines came and went as Gibson

waited– Suddenly Gibson’s test machine was

attacking Finland– Gibson decides to “neuter” the zombie and

just monitor it

Page 35: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Long Story Short

• Eventually he meets more senior hackers– Surprised to see him in the chat room– Gets them to talk to Wicked– Attacks stop

• He learns a lot about the Sub7Server trojan– Invasive zombie program

• Monitors key strokes for password, cc#s, etc.• netstat -an | find ":6667"

TCP 192.168.1.101:1026 70.13.215.89:6667 ESTABLISHED

Page 36: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

How Common are DDoS Attacks?

• Backscatter Analysis– http://www.caida.org/outreach/papers/2001/BackScatter/index.xml

• I’m not assigning this as reading– Idea is that almost all spoofed traffic uses a

randomly generated source IP• All popular DDoS attack tools do this

– trinoo, TFN, TFN2k, Stacheldraht, etc.

– When replies from victim are sent, they go to this (bogus) source IP

Page 37: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Backscatter Technique

• CAIDA (San Diego) owns large block of IP address space– They have a lightly-used Class A network– They assumed

• All source addresses uniformly chosen– Misses reflection attacks

• All attack packets reliably reach victim• All replies reliable leave victim• Any unsolicited replies seen by CAIDA were

backscatter

Page 38: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Approach

• Backscatter packets revealed– Type of attack

• SYN/ACK means SYN flood• ICMP messages from routers indicated other types

of attacks like UDP floods– IP of victim

• Source address of backscatter– Intensity of attack– Duration of attack

Page 39: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

Results

• 12,805 distinct attacks against over 5,000 hosts in 2,000 organizations in three weeks

• About 6000 packets per sec on average

Page 40: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

DDoS: Preventative Measures• Tracing and filtering

– If source addresses could not be forged, filtering would be a reasonable solution

• Ingress filtering– Idea: if you are an ISP, don’t let packets leave your IP address

space if they have source addresses out side your address space

– Old idea– Simple– Still a lot of ISPs don’t do this– Even with ingress filtering, attackers can jump around within a

range of IP addresses– Note that this limitation meant some backscatter numbers were

probably a bit off

Page 41: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

SYN Cookies

• A SYN flood leaves half-open connections– The “SYN queue” is a data structure which

keeps track of these half-open connections– We track the source IP and port of client,

server IP and port, seq# of client, seq# of server

– Idea: we don’t really need to keep all of this• We just need enough to recognize the ACK of the

client• Can we get away without storing anything locally?

Page 42: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

SYN Cookies: The Idea

• Store nothing locally– ISN: Initial sequence number– Encode all we need to remember in the ISN we send

back to the client– t: a 32-bit counter which increments every 64 seconds– K: a secret key selected by server for uptime of server– Limitations: MSS limited to 8 values

t mod 32 MSS hash(client IP and port || server IP and port || t || K)

Server ISN

5 3 24

Page 43: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

SYN Cookies: Details• MSS: Maximum Segment Size

– Suggested by client, server then computes best value• Details depend on whether they are on the same network,

MTU on network, etc• Server can have only 8 values to encode here

• What happens when client replies with ACK?– Client will reply with ISN+1 of server in the ACK– Server then subtracts 1 and checks against hash of

client IP and port, server IP and port, t which matches in the lowest 5 bits, and K

• If match, put in SYN queue• If not, ignore

Page 44: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

SYN Cookies: Limitations

• Note that this will NOT prevent bandwidth-saturation attacks– This technique seeks only to prevent SYN

queue overflows– If attacker can saturate bandwidth, this

doesn’t help• But note that bandwidth saturation is not going to

be TCP-based• UDP and ICMP can be used for bandwidth

saturation, but we are often less dependent on these protocols

Page 45: Foundations of Network and Computer Securityjrblack/class/csci6268/f05/slides/CSCI6268L16.pdf• Compile cc.c – Compiler sees that it’s compiling itself and self-replicating code

SYN Cookies: Implementation

• Standard in Linux and FreeBSD

echo 1 > proc/sys/net/ipv4/tcp_syncookies

• As far as I know, Windows does not implement them yet