We presented Secret Magpie at Blackhat!

Blog banner image


Our full slide deck and a presentation recording are embedded into this page.



Blackhat EU is the standout cyber security conference here in the UK, with some of the best speakers and content from around the world. Cutting edge research is shared from the top universities and commercial companies, as well as from exceptionally gifted independent researchers. This year was no disappointment, with talks on everything from financial fraud to hardware hacking through electromagnetic fault injection.

We were honoured to be accepted to talk about our research and secret scanning tool, Secret Magpie.

Secret Magpie is a completely free and opensource tool that aims to solve a very difficult problem.

Right now, hackers all over the world are looking for accidentally leaked secrets such as passwords and keys. When they find them, they are quickly used to launch ransomware and cryptomining attacks. These can be found in websites, application software packages, container images and source control systems.

What’s a cryptomining attack?

Attackers want to turn their efforts into money, and cryptomining is one of the easiest ways to do this. Once they have credentials for your cloud environment, such as AWS, they will then create servers which mini cryptocurrency. The more servers they can create, and it’s typically the really expensive servers, the more money they make in cryptocurrencies.

There are a lot of tools already doing amazing work to solve this problem. We love Gitleaks and Trufflehog.

The real issue is that scanning for secrets isn’t as simple a problem as it sounds like it should be!

What are the main issues with secret scanning:

1. Secret scanning has rubbish signatures or high false-positives rates

Secret scanning looks for patterns, and it’s very prone to false-positives. A typical API key may simply be 32 random characters, so to find them we need a pattern that finds 32 character strings. Unfortunately, that’s going to find a LOT of things that are not secrets.

People don’t like problems, so most tools are written to use patterns which produce a low number of false-positives. This essentially means they deliberately do not look for certain patterns, and therefore ignore some potential secrets. Even worse, some signatures rely on the detected secret sitting on the same code line as a keyword, such as ‘cloudflare’.

The solution is to write your own patterns and then handle the high count of false-positives.

2. When do we scan?

We can run our scanning tools manually, but this requires significant human effort. It makes a lot more sense to run the detection tools automatically.

We can run our scanning tools automatically in a few different scenarios, but they’ve each got their own issues (see the slide deck). We don’t ever get full coverage that forces someone to take an action.

… and then what happens when you write a new pattern to detect an API key for a service you found out that you use?

Secret Magpie allows you to run a full manual scan of every code repository in your organisation in one go, which allows you to iteratively improve your own patterns and retest them.

You can see our full slide deck below, and check out Secret Magpie on Github



… Or catch the recording here:

For more information, email us at [email protected] or call us on 01609 635 932

A recording of our Secret Magpie presentation

Author

Simon Gurney

- CTO -

Simon is one of the Punk Security Directors and has over 17 years experience working within IT, primarily focused on automation and InfoSec.

read more