Top Banner
Silvio Cesare <[email protected]> Deakin University
19

Simple Bugs and Vulnerabilities in Linux Distributions

Nov 18, 2014

Download

Technology

Silvio Cesare

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Simple Bugs and Vulnerabilities in Linux Distributions

Silvio Cesare <[email protected]>

Deakin University

Page 2: Simple Bugs and Vulnerabilities in Linux Distributions

PhD student at Deakin UniversityMalware detectionSoftware theft detectionAutomated vulnerability discovery

Speaker at Ruxcon, Blackhat, CSW and academic conferences.

This talk contains some Linux work done at university.

Page 3: Simple Bugs and Vulnerabilities in Linux Distributions

C Bugs

Environment Variable Fuzzing Bugs

Inter-Distribution Bugs

Embedded Packages Bugs

Page 4: Simple Bugs and Vulnerabilities in Linux Distributions

void *memset(void *DST, int C, size_t length)

Assign buffer contents to a specific value.

Zeroing a buffer is common.

C and length are sometimes confused.

memset(x,y,0) is almost always a bug.

Not very exploitable (except sensitive data).

Page 5: Simple Bugs and Vulnerabilities in Linux Distributions

Scanned Debian, Fedora, and Owl.

27+ bug reports for Debian.

2 bugs in Owl.

As a result, Debian now incorporating a memset check in their automated testing system.

Page 6: Simple Bugs and Vulnerabilities in Linux Distributions

/* Initialize to 0 so that test_parse_c gives reliable results */ memset (&Uni2, sizeof (Uni2), 0); memset (&Uni3, sizeof (Uni2), 0);

/*only the paranoids survive */memset( list, sizeof( HListNode ), 0 );

gnat-gps package in Debian

bibindex package in Debian

Page 7: Simple Bugs and Vulnerabilities in Linux Distributions

argv[0] is the program name passed by exec* to execute a command in Unix.

You can pass a NULL argv[0].

Crashes programs that (mis)use argv[0].

Unlikely to be exploitable.

A non null argv[0] should be enforced in the kernel.

Page 8: Simple Bugs and Vulnerabilities in Linux Distributions

In Debian using 2737 programs.

741 crashes.

27% crash.

Page 9: Simple Bugs and Vulnerabilities in Linux Distributions

Format String Bugsprintf\(getenv|printf\(argv1 format string bug in Debian (debug).

getsUse of this function is a bug.1 in Debian debug binutils h8300-hms

target.

Page 10: Simple Bugs and Vulnerabilities in Linux Distributions

argv buffer overflowsstrcpy\(.*argv|sprintf\(.*argv|strcat\(.*argvRestricted to SUID/SGID programs.Vulnerability in Debian xdigger SGID games.

getenv buffer overflowsSo many overflows in non privileged

programs.A future project is to submit bug reports for

these.

My PhD work use static analysis on binaries to detect simple bugs.

Page 11: Simple Bugs and Vulnerabilities in Linux Distributions

Need to know which programs to audit?

find / -type f \( -perm +2000 –o –perm +4000 \)

Better -> look at a package repository.

Fedora is aiming to eliminate SUID.

Page 12: Simple Bugs and Vulnerabilities in Linux Distributions

Debian298 SUID/SGID programs.

Fedora368 SUID/SGID programs

Debian now using my list on the security tracker.

Fedora using my list on the wiki.

Page 13: Simple Bugs and Vulnerabilities in Linux Distributions

Long env variables can trigger buffer overflows.

Attacker targets SUID/SGID programs.

Local attack – set hostile env variable, then run privileged program.

Public fuzzing tools for 10+ years, eg sharefuzz.

Page 14: Simple Bugs and Vulnerabilities in Linux Distributions

Fuzzed most SUID/SGID programs in Debian.

A number of assertion failures.

3 segmentation faults.

2 segv in SGID games programs.

1 SUID root segvzhcon package (bug in libggi).

Page 15: Simple Bugs and Vulnerabilities in Linux Distributions

If package FOO in Fedora vuln,

then package FOO in Debian probably vuln.

If no advisory, then it might be untracked.

Performed one time scan correlating Fedora and Debian advisories.

1 missing vulnerability in Debiangnucash package.

Page 16: Simple Bugs and Vulnerabilities in Linux Distributions

Software often embeds libraries or other code.

Classic example zlib compression library.

If zlib is vuln, update system library..

In embedded case, update needs to be done manually and package rebuilt.

Page 17: Simple Bugs and Vulnerabilities in Linux Distributions

Many libraries have version strings that identify them.

Manual approach is to grep for vulnerable embedded package signatures.

Bugs found scanning for libpng, bzip2, libtiff etc signatures in Debian and Fedora.

My PhD work replaces and automates this process.

Page 18: Simple Bugs and Vulnerabilities in Linux Distributions

16 vulnerabilities in Debian

15 vulnerabilities in Fedora

Eg, Fedora sepostgresql using a vulnerable fork of postgresql.

Fedora to use my results on their wiki.

Page 19: Simple Bugs and Vulnerabilities in Linux Distributions

For simple bug classes, given enough data you will find vulnerabilities.

Linux vendors have patched these or are patching.

http://github.com/silviocesare/Automated-Audits

Thanks for watching!