Forgotten admin password CTFd

So dumbass me, who only messes with CTFd in the week or so leading up to the monthly meeting, of course forgot the username and password for my administrator account on my CTFd server. [This is the server that keeps track of scores for people who have solved exploit challenges].

Of course the damn thing is in a Docker container, and everyone knows I’m a Docker n00b. But I’m determined, so I forge ahead.

I get into the docker container…

docker exec -it /bin/sh

I know it’s not running a database server, so I start poking around in the CTFd directory, and find ctfd.db, a sqlite database file. Jackpot.

I copy the file out of the docker container, because the sqlite command-line tools are not installed:

# docker cp (docker id):/opt/CTFd/CTFd/ctfd.db /tmp

At that point I just opened SQLite to it…

sqlite3 /tmp/ctfd.db

Let’s see what the schema looks like.

.schema

OK, so there’s a users table, but no admins table. Let’s look at users:

select * from users;

OK, there’s my admin account, now I know what the username was, it was one of the three I thought it would be. And there’s a column called “type” which seems to be either “user” or “admin” … The password column is encrypted, so that doesn’t help me.

So I register a new user in the web UI, give it a password, then go back to check my users table. Sure enough, there’s now an admin and a user. Let’s fix that.

update users set type=’admin’;

This would have been more finetuned had more users existed, but in my case there were no regular users but the one I created.

Back to the web UI, login as my new user, and sure enough, I have full admin rights. I don’t know what I was thinking or what I was drinking when I set that up the first time, but tragedy has been averted yet again.

And yes, I could have just rebuilt it, but all the flags for the vulnerable VMs are stored in it.

One week away…

The September meetup is a week away. I know this is a long shot, but if anyone has working configs for ANYTHING involving a BladeRF X40 and 3G/4G, please bring it.

The lab did NOT burn down yesterday.

Anyone want to give a hashcat tutorial?

Happy Monday!

Pic unrelated.

Sponsor DC540

If you’d like to help defray some of the expenses involved in running this group, please feel free to contribute to the GoFundMe for the CTF server, or contact [email protected] if you’d like to donate in some other way. I’d like to keep the meetings free and open for as long as possible, because so far, I like the people that attracts to the group.

Eleven days until the September meeting…

I’m ready, are you? If you’re joining us in the group Hackerbox build, have you ordered one?

Still haven’t heard from anyone wanting to present, teach or learn something, so it’s likely to be the same chaotic meeting as usual, with the added lubrication of festive beverages.

The space is just about ready, and my back hurts from all the rearranging. No photos, I don’t want to spoil the surprise.

The PCBs for the MultiPass badges should be here early next week. Some will be available for purchase if you’re interested.

Reminders:

  • This meeting is in my house. My house, my rules. Rule is don’t be a dick. Respect the other attendees, respect the space, respect the equipment. I’d like everyone to feel safe, comfortable and welcomed. Make this great and the space will stay available. Make it suck, and we’ll be back at the library.
  • Festive beverages are a thing here, but don’t be stupid about it, especially if you are driving. I’m not planning to serve food, but we could certainly go in on some delivery if folks get hungry. I will have some festive bevs on hand, but please feel free to BYOB.
  • Please RSVP on the meetup page so that attendance can be planned/capped.
  • Activities available: soldering station, including SMD tools; lock picking station; CTF server; fix my Mr. Robot badge;
  • While there’s no “official time” for the meeting (there’s no “official meeting” and no “official business” to be conducted), the space will be open from 6pm until dispersal or midnight, whichever happens first. Signage will direct you where to go. Everything you need to know is on the Meetup page.

Success!

I emailed Waveshare indicating my problem getting anything to display on the 2.13in epaper. They were VERY quick to get back to me, and suggested I try running the tests for another size, the 1.54in model, just to see what it did.

Turns out, that worked. So I started looking closer…

drwxr-xr-x 2 root root 4096 Sep 10 00:11 .
drwxr-xr-x 5 root root 4096 Sep 10 00:11 ..
-rw-r–r– 1 root root 2801 Sep 10 00:11 epd_1in54b_test.py
-rw-r–r– 1 root root 2657 Sep 10 00:11 epd_1in54c_test.py
-rw-r–r– 1 root root 2976 Sep 10 00:11 epd_1in54_test.py
-rw-r–r– 1 root root 2969 Sep 10 00:11 epd_1in54_V2_test.py
-rw-r–r– 1 root root 3756 Sep 10 00:11 epd_2in13bc_test.py
-rw-r–r– 1 root root 3020 Sep 10 00:11 epd_2in13d_test.py
-rw-r–r– 1 root root 3026 Sep 10 00:11 epd_2in13_test.py
-rw-r–r– 1 root root 3097 Sep 10 00:11 epd_2in13_V2_test.py
-rw-r–r– 1 root root 4006 Sep 10 00:11 epd_2in7b_test.py
-rw-r–r– 1 root root 3017 Sep 10 00:11 epd_2in7_test.py
-rw-r–r– 1 root root 3851 Sep 10 00:11 epd_2in9bc_test.py
-rw-r–r– 1 root root 3760 Sep 10 00:11 epd_2in9d_test.py
-rw-r–r– 1 root root 3822 Sep 10 00:11 epd_2in9_test.py
-rw-r–r– 1 root root 3981 Sep 10 00:11 epd_4in2bc_test.py
-rw-r–r– 1 root root 3147 Sep 10 00:11 epd_4in2_test.py
-rw-r–r– 1 root root 3859 Sep 10 00:11 epd_5in83bc_test.py
-rw-r–r– 1 root root 3154 Sep 10 00:11 epd_5in83_test.py
-rw-r–r– 1 root root 3981 Sep 10 00:11 epd_7in5bc_test.py
-rw-r–r– 1 root root 3147 Sep 10 00:11 epd_7in5_test.py

I had been using epd_2.3_test and the epd_2.3_V2 test, neither of which worked. After seeing it function properly on a couple of the 1in54 tests, I went through them all systematically. Turns out both epd_2in13bc_test and epd_2in13d_test work.

So I generated some red and black bitmaps, and using the example code as a template, pulled them in and displayed them.

What I love about epaper is that it doesn’t require power to display, only to change the display.

Now I’m looking at a 1500mah RPiZeroW-sized LiPo. I have other battery banks, but I like the idea of a low profile unit that can fit in a small pocket and maybe even be enclosed with the assembly. I was looking at this one…

https://www.amazon.com/gp/product/B07Q2C6B5H?pf_rd_p=183f5289-9dc0-416f-942e-e8f213ef368b&pf_rd_r=8CNZ36Q9MAZKK3C3J5T4

Pwnagotchi and MultiPass news…

So I spent more time than I care to admit this weekend trying to prep a Pwnagotchi platform (RPiZW and e-paper). The code (by @evilsocket) hasn’t been released yet, but I want to be ready. My mistake was only ordering one e-paper HAT from Waveshare. I should have taken failure rates into account. At least I’m 75% certain it’s a DOA unit. I tried numerous approaches based on numerous experiences by randos on the internet, and I couldn’t get that damned thing to display SQUAT. If it fed me back any data, it was just “e-paper busy.” Not helpful, Waveshare. Not helpful.

On the plus side, I was watching a video comparing different levels of USB microscopes for soldering (GreatScott!), and noticed that it was sponsored by JLCPCB, and they were offering a too-good-to-be-true deal on new PCB orders. So I went ahead and placed an order for ten MultiPass boards. Some of those will be up for grabs when they arrive. WAY cheaper than expected. I remain cautiously optimistic.

BadgeBuilding

So a few of us came to a consensus of wanting to work on Hackerbox #0046 “Persistence” for the upcoming September meeting. If you want in, bring one, and bring soldering gear. I have specialty stuff, like an electric solder removal tool and a hot air tool, but bring your basics — iron, solder, etc.

I am REALLY tempted to order boards and parts to assemble the DC27 Multipass badge, since the Gerber/Eagle files have been released along with the software. It will be a bit of a challenge for some — but we’re all about challenges, right? There are like 70 0603-sized SMD parts on it. I have more than half the parts in my lab already, but some parts I’ll need to order. If there’s enough interest, I can order stuff for the October meeting. Cost of the bare boards is about $36 each from OSHPARK, ordered in sets of three. If there’s enough interest I’ll price out the BOM and you can decide if it’s worth it to you to play.

In case you’re not following the Meetup Group…

It has been decided that for the foreseeable future, meetings will be held in my hackerspace basement (hackerspasement?) just a few blocks from the Gum Spring Library.

I (Bob) am looking to grow this group and its members. I am also looking to transition it into more of a cooperative and less of me being the main driver. I love hosting these things, and I’m more than happy to keep doing so, but I thrive on entropy. So for the future, I would love to see:

  • Someone step up to help out with comms for the group. A social media presence maintainer, so to speak.
  • Someone (or hopefully more than one) step up to offer to teach us something new. Along those lines, maybe for the September meeting we can collect a list of our collective weak points, and move forward from there in the act of bolstering them. Examples:
    • I’m reasonably strong on linux exploits, server hardening, network device hardening, and getting there on hardware hacking.
    • I’m weak on Windows exploits, buffer/stack overflows and reverse engineering. Anything that makes that knowledge more easily transmissible (shortcuts) is a good thing.

WOPR Jr update: It’s All Good.

Crossover cable came late today, and as suspected, when my laptop is connected through the gigabit switch and directly into the WOPR (as opposed to through the wifi), and I create a blank VM with BRIDGED networking through the ethernet cable, I’m able to deploy a fully-updated Kali instance to the VM (via FOG) in just over two minutes.

Shutdown and startup scripts are reliable. A quick shutdown script via ssh key tells WOPR to first SUSPEND all the VMs, then shut down itself. All the machines startup automatically when I power on the unit. The network is usable within a minute of powering it up.

Packing everything up for tomorrow’s meeting now…

  • WOPR Jr (check)
  • Wifi router (check)
  • Gigabit switch (check)
  • TPLink Wifi Extender (for attempting to piggyback on Library internet) (check)
  • Entertainment (check)
  • Swag (check)
  • …what am i forgetting?…

See you at the meeting. Or at the pregame. I’m going to hit the hot tub and then hit the sack. It’s been a busy weekend.