DOC PREVIEW
UW CSEP 590 - Computer Security and Privacy

This preview shows page 1-2-3-4-5-37-38-39-40-41-42-74-75-76-77-78 out of 78 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 78 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Tadayoshi KohnoCSE P 590 / CSE M 590 (Spring 2010)Computer Security and PrivacyThanks to Dan Boneh, Dieter Gollmann, John Manferdelli, John Mitchell, Vitaly Shmatikov, Bennet Yee, and many others for sample slides and materials ...Goals for TodaySoftware Security (Continued)• More attacks / issues• Defensive directionsCryptography (Intro)• Background / history / context / overviewResearch: IMDsTOCTOUTOCTOU == Time of Check to Time of UseGoal: Open only regular files (not symlink, etc)Attacker can change meaning of path between stat and open (and access files he or she shouldn’t)int openfile(char *path) { struct stat s; if (stat(path, &s) < 0) return -1; if (!S_ISRREG(s.st_mode)) { error("only allowed to regular files!"); return -1; } return open(path, O_RDONLY); }Integer Overflow and Implicit CastIf len is negative, may copy huge amounts of input into bufchar buf[80]; void vulnerable() { int len = read_int_from_network(); char *p = read_string_from_network(); if (len > sizeof buf) { error("length too large, nice try!"); return; } memcpy(buf, p, len); }void *memcpy(void *dst, const void * src, size_t n);typedef unsigned int size_t;(from www-inst.eecs.berkeley.edu—implflaws.pdf)Integer Overflow and Implicit CastWhat if len is large (e.g., len = 0xFFFFFFFF)?Then len + 5 = 4 (on many platforms)Result: Allocate a 4-byte buffer, then read a lot of data into that buffer.(from www-inst.eecs.berkeley.edu—implflaws.pdf)size_t len = read_int_from_network(); char *buf; buf = malloc(len+5); read(fd, buf, len);NextRandomnessTiming AttacksRandomness issuesMany applications (especially security ones) require randomnessExplicit uses:• Generate secret cryptographic keys• Generate random initialization vectors for encryptionOther “non-obvious” uses:• Generate passwords for new users• Shuffle the order of votes (in an electronic voting machine)• Shuffle cards (for an online gambling site)C’s rand() FunctionC has a built-in random function: rand()unsigned long int next = 1; /* rand: return pseudo-random integer on 0..32767 */ int rand(void) {next = next * 1103515245 + 12345;return (unsigned int)(next/65536) % 32768;} /* srand: set seed for rand() */void srand(unsigned int seed) { next = seed;} Problem: don’t use rand() for security-critical applications!• Given a few sample outputs, you can predict subsequent onesProblems in PracticeOne institution used (something like) rand() to generate passwords for new users• Given your password, you could predict the passwords of other usersKerberos (1988 - 1996)• Random number generator improperly seeded• Possible to trivially break into machines that rely upon Kerberos for authenticationOnline gambling websites• Random numbers to shuffle cards• Real money at stake• But what if poor choice of random numbers?Images from http://www.cigital.com/news/index.php?pg=art&artid=20Images from http://www.cigital.com/news/index.php?pg=art&artid=20Images from http://www.cigital.com/news/index.php?pg=art&artid=20Big news... CNN, etc..Other ProblemsLive CDs, diskless clients• May boot up in same state every timeVirtual Machines• Save state: Opportunity for attacker to inspect the pseudorandom number generator’s state• Restart: May use same “psuedorandom” value more than onceObtaining Pseudorandom NumbersFor security applications, want “cryptographically secure pseudorandom numbers”Libraries include:• OpenSSL• Microsoft’s Crypto APILinux:• /dev/random• /dev/urandomInternally:• Pool from multiple sources (interrupt timers, keyboard, ...)• Physical sources (radioactive decay, ...)Timing AttacksAssume there are no “typical” bugs in the software• No buffer overflow bugs• No format string vulnerabilities• Good choice of randomness• Good designThe software may still be vulnerable to timing attacks• Software exhibits input-dependent timingsComplex and hard to fully protect againstPassword CheckerFunctional requirements• PwdCheck(RealPwd, CandidatePwd) should:– Return TRUE if RealPwd matches CandidatePwd– Return FALSE otherwise • RealPwd and CandidatePwd are both 8 characters longImplementation (like TENEX system)Clearly meets functional descriptionPwdCheck(RealPwd, CandidatePwd) // both 8 charsfor i = 1 to 8 doif (RealPwd[i] != CandidatePwd[i]) thenreturn FALSEreturn TRUEAttacker ModelPwdCheck(RealPwd, CandidatePwd) // both 8 charsfor i = 1 to 8 doif (RealPwd[i] != CandidatePwd[i]) thenreturn FALSEreturn TRUEAttacker can guess CandidatePwds through some standard interfaceNaive: Try all 2568 = 18,446,744,073,709,551,616 possibilitiesAttacker ModelPwdCheck(RealPwd, CandidatePwd) // both 8 charsfor i = 1 to 8 doif (RealPwd[i] != CandidatePwd[i]) thenreturn FALSEreturn TRUEAttacker can guess CandidatePwds through some standard interfaceNaive: Try all 2568 = 18,446,744,073,709,551,616 possibilitiesBetter: Time how long it takes to reject a CandidatePasswd. Then try all possibilities for first character, then second, then third, ....• Total tries: 256*8 = 2048Other ExamplesPlenty of other examples of timings attacks• AES cache misses– AES is the “Advanced Encryption Standard”– It is used in SSH, SSL, IPsec, PGP, ...• RSA exponentiation time– RSA is a famous public-key encryption scheme– It’s also used in many cryptographic protocols and productsNextDefensive directionsToward Preventing Buffer OverflowUse safe programming languages, e.g., Java and C#• What about legacy C code?Static/dynamic analysis of source code to find overflowsBlack-box testing with long stringsMark stack as non-executableRandomize stack location or encrypt return address on stack by XORing with random string• Attacker won’t know what address to use in his or her stringRun-time checking of array and buffer bounds• StackGuard, libsafe, many other toolsExample companies: Fortify, CoverityNon-Executable StackNX bit for pages in memory• Modern Intel and AMD processors support• Modern OS support as wellSome applications need executable stack• For example, LISP interpretersDoes not defend against return-to-libc exploits• Overwrite return address with the address of an existing library function (can still be harmful)…nor against heap overflows…nor changing stack internal variables (auth flag, ...)Embed “canaries” in


View Full Document

UW CSEP 590 - Computer Security and Privacy

Documents in this Course
Sequitur

Sequitur

56 pages

Sequitur

Sequitur

56 pages

Protocols

Protocols

106 pages

Spyware

Spyware

31 pages

Sequitur

Sequitur

10 pages

Load more
Download Computer Security and Privacy
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Computer Security and Privacy and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computer Security and Privacy 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?