Wednesday, January 1, 2020

Today's project (setting up a knockd lab for CTF training) isn't improving my opinion of Ubuntu packaging much. This isn't the first time in the past week that I've run across munged packages and old code.

The scenario for the lab is that rubber hose cryptography was employed against an evil hacker and produced the following:

  • the hacker's handle
  • his workstation password
  • a sequence numbers = 2222, 3333, 4444
  • and that an encryption key will be available on a certain port

The student will be tasked with finding the hidden server in the hacker's private network, figuring out how to open the port on the server, and obtaining the key from the open port. The unstated facts include that only nmap and netcat are available on the hacker's workstation.

In the first 30 minutes, I was able to design a Docker container that runs supervisord, knockd, socat, and an internal (to the container) version of iptables. In the subsequent hour, I'd tried various things to get knockd to properly run the close-port command. Even the configuration examples provided by the original authors didn't work. The "iptables -D" commands would work on the command line but not when called by knockd.

To make the story short, if you're using the Ubuntu knockd package, the close command will need to be wrapped in "bash -c 'the command'" before it'll work properly. I've added "patching" to my to-do list but it's near the bottom (won't be any time soon). At the top of the list is adding this instance to the OVS architecture, which resides behind a Guacamole instance, and adding a dynamic flag calculation for use in CTFd.

Saturday, December 28, 2019

xpra

Spent a good portion of the morning playing with xpra on Ubuntu 18.04. Initially, didn't like it much as Ubuntu's prepackaged binary is crap (lacks the HTML5 portion of the larger code base). After switching to the hosted repos, I was able to get it to execute. However, in the long run, it wasn't what I was seeking.

Thursday, December 5, 2019

What was I reading in November 2019

Another busy month. Worked on getting setting up easily deploy-able private architectures for students, using Docker, OVS, and some scripting. Mixed in some Guacamole and a touch of image mapping, and we have our first lab for the firewall class. Also spent the last of the 2018 Christmas money on classes (I'm now backlogged for 15 classes).

2019-11-07

- Pwn2Own Tokyo 2019 - Day One Results
- Rage Against the Maschine - a discussion on reverse engineering of a specific piece of hardware
- Isolating the logic of an encrypted protocol with LIEF and kaitai - more reverse engineering
- Feature walk-through for the XAMN v4.4 forensics tool

2019-11-08

- OpenAI has published the text-generating AI it said was too dangerous to share - Someone believes their own hype a bit too much, I think...
- Bypassing GitHub s OAuth flow
- One man's junk
- GitRoyalty - WTF?! If you drop opensource behind a paywall, it's not opensource anymore! This is dumb.
- Rethinking the inotify API as an offensive helper

2019-11-11

- File Signatures - a must-have!
- CTF Resources - a work-in-progress

2019-11-17

- We reduced our Docker images by 60 with no-install-recommends
- 5 Practical Examples of the dd Command in Linux - I revisited this while learning more about using binwalk to extract hidden files from other files.
- Extracting Kerberos Credentials from PCAP

2019-11-20

- The Early History of Usenet, Part II: The Technological Setting
- Configuring Ansible
- Don't Blame the Internet for New Slang

2019-11-21

- A Clever Way To Find Compiler Bugs

2019-11-27

- AlphaStar: Grandmaster level in StarCraft II using multi-agent reinforcement learning
- Destroying x86_64 instruction decoders with differential fuzzing
- whitequark/unfork

2019-11-30

- Study: There may be no such thing as objective reality - A bit too much on theory and philosophy. A discussion, where an experiment (e.g., Schrodinger’s Cat) relies too heavily on dependencies and/or limitations on the experiment. Most everyone can tell you if the cat is alive just by listening or picking up the box. Short version: a scientist's version of navel-gazing.

Above was generated by a homegrown bolt-on script for Wallabag, which is a free utility for capturing web content so that it can be read later.

Saturday, November 30, 2019

Moloch's network authentication

Looks like it's time to switch to "tech writer" for a few days. Finally figured out why Moloch (think web version of Wireshark) wasn't accepting the network authentication. Moloch is a very nice tool (especially for teaching environments) but the install docs are a bit short.

The "hidden detail" was in how the reverse proxy mangles specific header variables (what goes into the proxy config isn't what is delivered to Moloch). Had to write a variable dump script before that was noticeable.

In any case, TC4 IDS students now have a very nice way to view captured packets.

Wednesday, November 27, 2019

Fixing Moloch's Hunt function for anonymous users

For those working with Moloch in single-user (anonymous) mode (where the passwordSecret line in config.ini is commented out), you may have noticed that the "Hunt" option doesn't work out-of-the box. Moloch will complain about the anonymous user not existing.

The fix is the obvious work-around (i.e., create the anonymous user). This can be accomplished from the command line, via:

/data/moloch/bin/moloch_add_user.sh anonymous "anonymous" PaSsW0rD

You'll never need to log in as the anonymous user so make the password difficult and don't re-use the password from one of your other accounts.

Saturday, November 23, 2019

Proactive to a (big) fault

Dealing with locked accounts today. My ISP account was locked due to inactivity (apparently pulling email doesn't count as "activity"). My Amazon account was locked due to my acquiring a new phone (6 months ago).

The Amazon account is unlocked, as is the ISP account, but the ISP account is still acting weird. ISP locked the customer account because of inactivity (apparently they don't consider paying their monthly bills as "activity" either). Care to guess how they notified me?

(For the above, if you guessed "via email to the locked account", you get 10K points!)

It's still not entirely fixed. I can send email to the ISP account from another ISP account but can't receive mail from anywhere else. Plus, my mail client has not been downloading any Kryptos group traffic for the better part of a year (thought the group had gotten quiet). Instead the traffic lands in the ISP inbox and is somehow invisible to my client. I'm seriously thinking about hosting email elsewhere.

Thursday, November 21, 2019

What I did with a week's vacation

Other than continuing to work (yeah, I know), I learned how to integrate OpenVirtualSwitch (OVS) and Docker, so that I could create an architecture that a professor has desired for the better part of a year.

Basically, I combined OVS, Docker, and Guacamole, so that each of 30 students could have a 3-node architecture consisting of a SSH host and a web server, with a VyOS firewall in between, and two virtual switches connecting everything together. I managed to pull it off on a machine with one CPU, consuming less than 10 GB of HD space and about 5 GB of memory. I imagine that one vCPU won't be able to keep up with stresses generated by 30 concurrently online students but so far, they've only been online 1 or 2 at a time. I can always add one (or more) on the fly.

The more I read about OVS, the more I like it. The next lab project will involve setting up an IDS environment, with two end points (one running tcpreplay) connected with a single virtual switch, which allows for port mirroring to a Snort container. Like the other project, Guacamole will run on top of this project (goal is to not require the student to have anything other than a browser).

I've not yet learned about SDN controllers but did manage to write a series of Perl scripts to do things like: deploy the containers, deploy the switches, connect the switches to the containers and connect them to Guacamole, and associate the Guacamole user accounts with the containers. Once the requisite software is installed and the Docker images are created, deployment of 30 private architectures only takes a few minutes (much quicker than cloning VMs).

If things go wrong and a student cannot correct their mistakes, the scripts are written so that a single student's architecture can be destroyed and redeployed. Additional scripts were written to check that all containers and switches are operating as they should.

The hard part was getting the three containers tweaked "just so". Such required making changes to a container, committing it to new container, destroying the old architecture, and redeploying the whole thing, using the new image. Scripting the process made it super easy.

Just in time for finals. Sorry guys!