Tunneling network traffic over DNS with Iodine and a SSH SOCKS proxy

Accessing the internet via restricted networks can be a pain. But so can be securing a network and putting those restrictions in place. Let’s have a look at how DNS tunneling can in some cases allow getting data in and out, when regular access is blocked or otherwise restricted, but DNS queries work. Seeing this technique in action can help you understand how unauthorized users could get around your security measures and use less monitored channels for communication (e.g. for malware command and control), or may come in handy when doing an attack simulation yourself. In addition, it’s a fun way to mess with captive portals which often kind of “man-in-the-middle” your connection to direct you to a sign-up page, but still let you resolve names in any state. ...

May 12, 2019

HTTP requests with PowerShell's Invoke-WebRequest – by Example

If you ever find yourself on a Windows system needing to make a HTTP request, the Invoke-WebRequest cmdlet will be your friend. Let’s have a look on how to send various things with iwr (legit alias!) and how to get around common issues. We will be focussing on (manually) sending/requesting data, not so much on reading/parsing it. In case it’s the first time you’re using Invoke-WebRequest or doing stuff with PowerShell in general, I recommend reading this post sequentially from top to bottom. ...

April 12, 2019

MySQL case-sensitive LIKE search

When searching for partial strings in MySQL with LIKE you will match case-insensitive by default*. SELECT name FROM users WHERE name LIKE 't%' +--------------------+ | name | +--------------------+ | Test | | test | +--------------------+ If you want to match case-sensitive, you can cast the value as binary and then do a byte-by-byte comparision vs. a character-by-character comparision. The only thing you need to add to your query is BINARY. ...

February 25, 2019

Hidden in plain sight: Alternate Data Streams

Have you ever wondered how a file in a file listing is shown with size 0 bytes but can still contain data? Or maybe wondered where all that meta data is stored, how malware can infect files or just how you can “hide” stuff in a file? Let’s talk about Alternate Data Streams to learn more. ADS - Alternate Data Streams When you hear “Alternate Data Streams” you may think about resource forks in Mac OS HFS. But we’re talking about Windows and NTFS. Back in the days of Windows NT 3.1 (ha!), NTFS streams were actually implemented to support the Mac resource forks. ...

February 23, 2019

UnicodeError when running Python script via macOS LaunchAgent

If you are getting UnicodeErrors when reading/manipulating files using a Python script launched by a LaunchAgent or crontab, the problem might lie in the “current locale encoding”. Sample script Let’s assume you have the following code in a script set up to be launched by a LaunchAgent (also see my article on LaunchAgents): with open(some_path_to_file) as f: f.read() Let’s also assume that some_path_to_file points to a txt file containing some emojis (hey, why not? 😎) or some other unicode characters. ...

December 7, 2018