+++ date = ‘2025-10-10T19:49:47-07:00’ draft = false title = ‘picoCTF2025: Virtual Machine 1’ +++
View solve on github
I thought it would be a good idea to try another picoCTF problem. I noticed none of the problems on last week’s picoCTF Mini were hard, so I picked Virtual Machine 1. This problem has 429 solves and a whopping 30% satisfication rate
d
The enemy has upgraded their mechanical analog computer. Start an instance to begin.We grabbed this design doc from enemy servers: Download. We know that the rotation of the red axle is the input and the rotation of th axle is output. Reverse engineer the me blueechanism and get past their checker program:thnc saturn.picoctf.net 60698.
CAD Model
First off,
|
|
we get a COLLADA .dae file??? A 3D File?? I don’t have anything that opens COLLADA files (blender removed support a few versions ago), so I converted it into a STEP file using imagetostl.com

We get a sneak peak at the model, this will be fun…

It looks like OnShape has failed to translate the file (over 30 minutes) So I converted it into a .blend and opened it with blender
And then exported it as .glTF so I could import it into OnShape (I think the gear relations and revolute parameters might come in handy)
While it’s converting (hopefully), lets inspect the model first, it seems to be some Lego Technic gears, with some differentials(?)
Let’s take a look at the instance first:
|
|
It looks like the machine is a calculator, 50299 might in radians or degrees or turns, or something like that. We have to solve for the rotation of the output blue axle with relation to the red input axle.
The OnShape finished importing:

Breaking down into Sections
We can start working on it in sections:

Lego Gears
Here is a list of Lego gear sizes:
And a differential
The differential is a Technic, Gear Differential 24-16 Tooth
Separating the gears, we see a total of 6 distinct gear ratios

“Differential Equations”, lol
The differential acts as an averaging mechanism for rotational velocities:
$$\omega_{diff} = \frac{\omega_1 + \omega_2}{2}$$
where $\omega_1$ and $\omega_2$ are the input rotational velocities. Thus, we need to split this section into two parts, by first calculating $A_{1,1}$ and $A_{1,2}$

Section I
We can derive both sections symbolically with python:
|
|
But wait…how do we handle rotation on different axis??
Let’s define positive rotation as clockwise when viewed from directly above. But the question still remains, how do we define rotation in the horizontal axis? Lets arbitrarily define it as clockwise when viewed from the right when viewed from the back:
Let’s also give the gears on different axis different names:
With this configuration, if a pitch axial gear (with $\omega$ b) is on the left of a yaw axial gear (with $\omega$ a), then b=-a, and vice versa.
Thus,
|
|
Now, we can calculate $A_2$, first labeling the gears
Section I Summary:
$$A_2 = -A_1 \times \frac{24}{8} \times \frac{16}{8} \times \frac{1}{2} = -A_1 \times 3$$

|
|
Section II
Let’s annotate in a similar fashion Section #2
This looks daunting, but it’s not that bad. We have 6 distinct sections.
Let’s number them:
We can start coding now!
We now have $B_{2,1}$ and $B_{2,2}$:
|
|
Then, we can derive $B_{3,1}$:
Ooops! It looks like this section (orange) is NOT a 36t, but 3x12. Now we can calculate $B_{3,1}$:
|
|
Moving on, we calculate $B_{3,2}$ using $A_2$

|
|
The approach is repetitive, but my brain is overwhelmed already, so I’ll do things the brute-force way.
With $B_{3,1}$ and $B_{3,2}$, we can calculate $B_3$ using the differential equation (1):
|
|
This allows us to calculate $A_3$ relatively easily:
Section II Summary: $$A_3 = -B_3 = -\frac{B_{3,1} + B_{3,2}}{2}$$
|
|
Section III
We notice a heuristic here,
We notice $A_1:A_2 = A_3:A_4$, so we can use the same transformation function for both sections.
Section III Summary: $$A_4 = A_2(A_3) = -A_3 \times 3$$
Thus, we just plug A3 back into our A1->A2 function, and we solve the entire system with:
|
|
Complete System Solution
The complete system can be represented as a series of transformations:
$$A_2 = f_1(A_1) = -A_1 \times 3$$ $$A_3 = f_2(A_2) = -\frac{B_{3,1}(A_2) + B_{3,2}(A_2)}{2}$$ $$A_4 = f_3(A_3) = -A_3 \times 3$$
Final System Equation: $$A_4 = f_3(f_2(f_1(A_1)))$$
Where the overall transformation is: $$A_4 = A_1 \times 9 \times \frac{B_{3,1}(A_1 \times 3) + B_{3,2}(A_1 \times 3)}{2}$$
Plugging it in
Lets see if it works!
|
|
Nope, looks like my use of the same character as both the variable and function name is causing issues.
|
|
Looks like it works! Let’s test it on our input.
|
|
Sighhh…this mean we only have one more attempt, let’s invert the sign of our input to see if we are using different coordinates.
Since I didn’t want to wait 360 seconds, I launched a new instance and inverted the number
|
|
|
|
YAYYYYYYYYYY. Total time took: 2hr 10min including time it took to write this, so I guess it would have taken roughly 2/3-1/2 the time without.
Complete System Analysis
Mathematical Summary
Key Equations:
-
Differential Averaging: $$\omega_{diff} = \frac{\omega_1 + \omega_2}{2} $$
-
Section I Transformation (A₁ → A₂): $$A_2 = -A_1 \times \frac{24}{8} \times \frac{16}{8} \times \frac{1}{2} = -A_1 \times 3 $$
-
Section II Transformation (A₂ → A₃): $$A_3 = -\frac{B_{3,1}(A_2) + B_{3,2}(A_2)}{2} $$
-
Section III Transformation (A₃ → A₄): $$ A_4 = -A_3 \times 3 $$
Complete System Solution: $$A_4 = A_1 \times 9 \times \frac{B_{3,1}(A_1 \times 3) + B_{3,2}(A_1 \times 3)}{2} $$
Full Code:
|
|
Other approaches
Let’s see how other people approached this problem. Searching for “picoCTF 2025 Virtual Machine 1”, I don’t see any solution besides this one, which did not provide a solution. Quite disappointing… I wanted to see if there was a faster way.
Looking at it, I can’t think of a faster way or a shortcut to solving this, besides modeling it out in OnShape and doing gear relations for each gear, this would help us solve A1->2 A2->3 relations faster? I don’t know how much faster it would be or how accurate it would be. It would also be fun to build this out, but I would like to think that would take more time.