Automating Digicert Certificates Into AWS ACM

Like most security professionals I am spending a large amount of time helping my company move securely to AWS.
Certificate management in AWS is done with AWS Certificate Manager  and while they do offer *free* certificates, ACM generated certs are outside your direct control. You don’t get the keys which, at least for some things, should probably be a non-starter (granted, for plenty of other things it’s likely  ¯\_(ツ)_/¯).
I also really like digicert and have been using them for TLS certificates for over 10 years but I could not find any automation already built for Digicert to AWS ACM so I spent some time this week and hacked a script together to do it.
Here is a link to the script  (also embedded at the bottom of the post). On the host running the script you will need AWS CLI  configured and a Digicert API Key.  You also need to configure the first 15 lines of the script with your information.

To Run The Script:

./awasacm.sh your.fdqn.com

Script Output:

Here is what the script looks like running:

Here is the cert uploaded to ACM:

The script also saves all of the commands, keys and certs on the host running the script for auditing and backup:

Full Script:

https://gist.github.com/jgamblin/f8bd03d3743ba4f08f710d5e11c177c7

Closing:

I will be making improvements to this script as we implement it in production and will likely move it to a full GitHub repo soon.   If you have any questions please reach out to me on twitter at @JGamblin. 
Update:  I have built a full Github repo here.

Big Data’ing The Umbrella DNS Popularity List

Recently I started looking at the Umbrella DNS Popularity List and did a blog post about it here. The data seemed valuable and lacking at the same time so I spent my *limited* free time this week learning about R and RStudio.
Protip:  If you want to play along at home there is an RStudio docker container so all you need to do is:

docker run -d -p 8787:8787 -e USER=<username> -e PASSWORD=<password> rocker/rstudio

Getting today’s list loaded into R is as simple as:

# Get Todays List
if (file.exists(fn)) file.remove(fn)
temp <- tempfile()
download.file("http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip",temp)
unzip(temp, "top-1m.csv")
today <- read_csv("top-1m.csv", col_names = FALSE)
unlink(temp)

Now you have the Top 1 million DNS requests from Umbrella ready to be “big data’ed”.
At the start of this project I wanted to do the following:
Search the DNS names for keywords. (Done).
Map all the DNS records on a map. (Done, Kinda).
Compare today’s and yesterday’s records for new DNS records.
Check all the DNS records against Censys and record open ports, and software.
Check all the DNS records against VirusTotal and see if any of them are known bad.
Check all the DNS records against SSLLabs and record SSL grade.
Take a nap.
My limited results so far follow with hopefully more to come.

Search The DNS Names

I wanted to do this to be able to search the list for a keyword and build a table and map of the data.  This was fairly easy and with help of leaflet and datatables here is the output of searching today’s data for cisco.
Here is the map:

Here is a link to the data. 
Here is the R code I wrote:
https://gist.github.com/jgamblin/7615b81cedd10e44d4f2220347b69cb0

Map All The DNS Records On A Map.

I got started on this and quickly realized that looking up the GEOIP information and mapping a million DNS records was going to take a week so I decided to do the Top 25,000 as a POC and come back and do all 1,000,000 later (maybe).
Here is the 25,000 Map:
Here is the R code I wrote:
https://gist.github.com/jgamblin/ccf3390bc5d2ce922cd5df38a40617b4
I also built a map with the Top 100K on it but it is huge (Load at your own risk).

…More to come.

I will be spending some more time on this over the next couple of weeks but cant think @EngelhardtCR and @hrbrmstr enough for all the help they have been over the last week as.   They are true data scientist and I am just a hacker with a blog.  : )
If you have any questions or suggestions please let me know on twitter at @jgamblin.
Here is a picture semi related to this blog post to make it look pretty when I share it on social media. 

Automating DigiCert Certificate Issuance

I am a big fan of DigiCert for TLS Certificates and CA/WebPKI services.   While they have amazing customer support and are an amazing company to work with, there are not a lot of automation scripts to interact with their API available. So over the weekend and with a lot of help from Clint Wilson I built a shell script that:

  • Creates a CSR/Key pair using OpenSSL.
  • Uses the Digicert API to:
    • Request a TLS certificate.
    • Approve the certificate.
    • Download the certificate in:
      • .zip
      • p7b
      • pem
      • pem (with no root)

Here is the script in action:

Here is the code:
https://gist.github.com/jgamblin/bd04b9ef8fe3660f4a247cc7d2109df0
I have tested it on OSX,  Ubuntu and CentOS7 and it is fairly cross platform friendly.  Extending this script to install it should be easy but we already had the automation built to do that so it was not necessary.
Let me know on twitter if you have questions.

A Threat Intelligence Thought Exercise

I was at dinner on Tuesday with 6 security professionals and I proposed this hypothetical situation and I thought it was worth writing up and sharing.

Background:

  • Six identical safes with $1,000,000 inside are being built into the side of a public building and are being randomly assigned to everyone at the dinner.
  • At the end of 90 days any money left in your safe is yours.
  • You will be given a live video feed of your safe.
  • There is an advanced and persistent team of safe crackers trying to crack all six safes.
  • You are loaned $100,000 to spend on security for your safe that must be repaid when  the project is over.
  • Everyone at the dinner is your friend.

Threat Intelligence Questions:

  • While doing video monitoring you notice that you see activity that you think is coming from the safecrackers every Monday night from 2100 to 2200.
    • Do you tell the other safe owners?
  • While looking at your safe you try the passcode 8675309 because the song is stuck in your head and find it is an unknown one time backdoor.
    • Do you tell the other  safe owners?
  • You are approached by 2 other safe owners who would like to form an alliance with where you will share all information you have on threats and at the end of the 90 days you split any remaining money evenly.
    • Do you join the alliance?
  • Does sharing what you know with the other safe owners make you more or less secure? 
  • Does joining the alliance  make you more or less secure? 
  • If 4 people are in the  alliance does that make you more or less secure? 

Bonus Traditional Security Questions:

  • A physical security firm will place an unarmed but well meaning guard in front of your safe from 0700 to 1900 every day for the 90 days. The cost is $40,000.
  • A monitoring firm will monitor the video feed of your safe for the 90 days and send you a text message if something looks wrong. The cost is $40,000.
  • A famous ex-hacker will spend two weeks trying to break into your safe and another week writing a report you will only kind of read. The cost is $60,000.
  • A company has a team of 100 less skilled but trust worthy safecrackers who they can have try to break into your safe. They will run the program for you, pay a reward to anyone who successfully cracks your safe and tell you exactly how the did it. The cost is $60,000.
    • How do you spend your money?
  • On day 30 you are told only one safe has been successfully broken into.   You have not spent any of your money.
    • Do you buy anything now? 
  • On day 60 you are told only one safe has been successfully broken into.   You have not spent any of your money.
    • Do you buy anything now? 

I think there are a bunch more questions I could ask but I think this is a great thought exercise to think through and discuss.
If you have any thoughts you can share them with me on twitter @jgamblin. I just do not have the patience to moderate blog comments.
Here is a picture of a safe so my links look better when I share this:

Port Scanning Through TOR

Scanning a host with Nmap is a fairly routine act for some in security to do but you from time to time you want to either get a different view of a host or try to  conceal your public IP.  In this case I use this simple “trick” to run an nmap scan through TOR.
To do so you need to make sure you have nmap, tor and proxychains installed on your machine.
The simplest way to install these tools on ubuntu is with this command:
sudo apt-get update -y && sudo apt-get dist-upgrade -y && sudo apt-get install tor nmap proxychains -y
Once that is complete  proxychains nmap +options +target will  run your nmap scan through the TOR network via proxychains. In this example I ran proxychains nmap --top-ports 10 -sT -PN -n -sV 50.87.249.69 against my blog:

A couple of protips:

  •  This method is slow. You will want to know the hosts and the ports (-top-ports 10) you want to scan and scope limit as much as possible.
  • This *isnt* 100% anonymous.  While using proxychains and tor will give you a basic level of anonymity its not irreversible.
  • Wear mittens when it is cold outside. 

Grizzly Steppe IP and Hash Analysis

Yesterday US-Cert released information on GRIZZLY STEPPE  the malware used in the DNC hack.  The IP and hash information provided by the US-Cert was really lacking  so I decided to dig through it and see if I could make more of it.
The first thing I did was to run the  IPs through an ipinfo2sheets spreadsheet I put together earlier this year and got way  better data:

Once I got more data for the IPs I noticed that it looked like there were a lot of TOR exit nodes on the list.  So I cross referenced the IP addresses from the US-Cert against the TOR exit node list and 21% (191 of 876) of them were TOR exit nodes:
From there I decided to map the IPs on a google map to see where they were all located:

Next I looked at the hashes and this morning VirusTotal says that only 28% of AV detects the Grizzly Steppe files:

I put a copy of this spreadsheet here.

Overall after spending a few hours looking at the Grizzly Steppe data it is disjointed,  ambiguous and really doesn’t provide any actionable data for most companies.

DIY USB Killer

In November I saw this youtube video on turning a USB Air Purifier into  a  $75 USB Killer:

My soldering skills are basically nonexistent so while I had some time off around the holidays I decided this would be a decent project to help improve them.
So in early December I ordered 3 of these from Amazon:
USB ionic Oxygen Bar Freshener Air Purifier ionizer For Laptop Black+White

These from GearBest would also work:
Rotating USB Style Air Cleaner – WHITE AND BLACK
A week or two after I ordered them this ChinaPost envelope showed up in my mailbox:  
I got my soldering station set up and was ready to go to work:
After snapping off the case the first thing your have to do is desolder the pigtail:


The next step is to solder a wire  to the resistor towards the bottom of the board:

You then solder the other end of wire to the data lead on the USB connector:

(Tip: You should probably use more than 24 awg wire.)

You now have a USB Killer to *not do* evil things with:
Disclaimer:  Dont be a JERK. This will fry motherboards.  Dont plug it into anything you are not ready to replace. 

Digital Ocean Slack Bot

I had a coach whose favorite quote was “Pain is the best teacher.”  and that was the first thing that popped into my head this morning when I realized that I had left an $80 a month  Digital Ocean Droplet  running for an extra 3 weeks after I got done using it.   To be honest $60 isn’t *that* painful but  it did prod me to write a slackbot that will post all my running droplets to slack once a day:
 

Here is how I set it up:

https://gist.github.com/jgamblin/83f7eb018d7953497e30802ed23e2041

  • Copy this line to your crontab to post a list of running droplets at 0800 everyday:
    00 08 * * * /path/to/dobot.sh
  • Enjoy not wasting money on abandoned cloud servers.

8 Security Predictions for 2017

 

What will 2017 hold for the security industry?    I sat down and looked into my crystal ball and came up with these 8 security predictions for 2017. 

A Fortune 500 Will Use “DDOS as a Service” To Attack A Competitor.
A bored VP of Marketing with a paypal account, a six pack and a nephew who can get him on the “undernet” is the cyber warrior of the future.
Internet of Thing (IoT) will continue to be used as an attack platform.
Who would have thought that un-patched, un-maintained linux operating systems exposed to the internet would be used to do evil?
Hacking As A Service Will Take Off.
Want into your bosses/spouses/political opponents email account? A hacking group will sell you access for $500.
Hackers Discover & Exploit Automation Platforms.
Hackers finally realize they only have to own the automation platform (Chef, Puppet and SaltStack) of most companies to own the whole company.
Red-Teaming Will Still Be easy.
…and there will be 437 conference talks about how awesome it is.
A Killer Android Bug Will Be Found.
A remotely exploitable android bug that allows for remote camera, microphone and speaker access will be found and will be un-patchable on 75% of phones. Causing Google to take control of the OS and push patches to all phones.
Hackers Will Interrupt A Major Sporting Event.
Just think what would happen if the Russians, Chinese or a 400-pound hacker sitting on his bed decided to take Fox offline during the opening kickoff.
Security Will Still Be Hard.
…and no one as invented the magic box you can plug into your network and make it easy.
Remember though… you can change the future of security in 2017 by working hard and doing something that makes a difference.  Get involved in the EFF,  write some amazing open source software,  volunteer to mentor someone interested in security.

KaliZero: A piZero USB Gadget Running Kali

I have been playing with my stack of pizero a bunch lately and tonight I decided to put together a piZero OTG Ethernet gadget that runs Kali (Really KaToolin),  XRDP and Mate in a computer on a stick configuration.  This way I have a full (as I want it to be) Kali installation with me as long as I have access to a USB port.

 
Here are the steps to build your own:
Install your pizero as an ethernet gadget.
Share your internet connection with your piZero:

You can now login into your PiZero at:
[email protected]

Copy and Run this shell script:
https://gist.github.com/jgamblin/d929d98acca84140684f1d06bfaf6336
Reboot:
sudo reboot
Configure RDP and access your KaliZero:
Use KaToolin to install the tools you want:
sudo katoolin
**Be Warned:  The piZero is slow.  It is usable for basic tasks but is not amazing.

Site Footer