Skip to content

Instantly share code, notes, and snippets.

@bahorn
Last active February 21, 2018 19:27
Show Gist options
  • Save bahorn/0df2d3dc5dbfd36d15a36044456e06f8 to your computer and use it in GitHub Desktop.
Save bahorn/0df2d3dc5dbfd36d15a36044456e06f8 to your computer and use it in GitHub Desktop.
CovHackSoc Security Talk

CovHackSoc Security Talk

Talk is meant to be an overview of various security flaws you find in software and how to exploit them in a Capture The Flag context. Meant to cover each vulnerablity class quickly to get the general idea of what they are looking for.

I'd like to accompany this with some exploit dev examples.

This is meant to be the precursor for running our own Capture the Flag.

Probably at least 2 lectures worth of material here.

Quite Linux focused. Most of the techniques work on Windows but you have to consider how they structure things.

Should add some BSD based resources.

Tools

A lot of people think this stuff needs crazy tools, but in reality we are basically using debuggers and python scripts.

Debugging

GDB

GDB is the standard debugger most Linux users end up using. You'll want to install the plugin GEF.

strace

Allows you to track what syscalls a program is making.

Reversing

Strings

Allows you to find ASCII text in binaries.

Objdump

Part of the GNU binutils.

Radare2 (And it's GUI Cutter)

Exploiting

Pwntools

Awesome Python framework for developing exploits.

Metasploit

Exploit framework written in Ruby, known for providing public exploits in a nice usable tool for pentesters.

Ropper / ROPGadget

When writing memory corruption exploits, you often need to get a ROP chain going. I found these tools pretty good for that.

Other

Checksec

Lets you check what exploitation mitigations are enabled on a binary, part of pwntools.

Key Ideas in exploitation

Primatives

Probably one of the most important ideas. Too many people focus to much on the exact bug they have and can't see the bigger picture on how to use it. Taking your overflow and turning it into a arbitary write is the aim. You can often even turn arbitary writes into memory leaks by just removing the null byte off the end of a C string and then triggering a read of this string.

Reliablity

Commonly misunderstood. People tend to think that all bugs are alike, but in reality how reliablely you can exploit it without say triggering a crash varies. In use-after-frees, you are always relying on luck to get your object placed where the old one was. What seperates how reliable they can be is how much you know about how the heap allocations are done to get it appearing where you want (the size of the buffer you are allocating, how frequenctly, etc matter).

Targets

Userland

Userland just refers to normal procesesses running under standard accounts.

Kernelland

Kernelland is a higher privellenge level, often targeted locally to gain increase privs.

Web

CPU Architectures

These are the architectures you will generally care about.

x86

AMD64

64 bit extentsion to x86.

ARM

Memory Corruption

Memory corruption is one of the more interesting and difficult areas of exploitation. You need to consider where you are corrupting memory and how.

You want to consider what interesting meta data is nearby. (For stack overflows, the base pointer and instruction pointer are the ones you generally care about)

Stack Overflows

Heap Corruption

Time of Check / Time of Use

Use After Frees

Race Conditions

Exploit Mitigations

W^X memory

RELRO

ASLR

Other

Web/Logic

SQL Injection

Injecting and modifying existing SQL queries based on unsafe query construction.

XSS

SSRF

Making the server request resources that it shouldn't.

LFD

Downloading files from the target can be often very useful, expecially as it can be used to leak secrets that can later be used to attack deserialization in certain languages (Ruby, Java, etc)

Inclusion

Generally PHP specific.

Deserialization

The best bug you can find. These are 100% reliable remotes.

Exploit Mitigations

Cryptography

In general, look for Cryptography where they aren't using a MAC (Message Authetication Code). You'll be able to preform active attacks, which are the more interesting ones.

Common Flaws in Block Cipher Implementations

ECB

Modifying CBC known plaintexts

Reusing Nonces in CTR mode

Timing Attacks

Case Studies

... Ideas Here ...

CTurt's BSD Kernel uninitalized mem leaks are good examples.

Resources

Information

Media

Practice

Tools

Cheatsheets

Papers to Read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment