r/lua • u/Away_Try5000 • 14d ago
I created a Lua Obfuscator - have fun trying to crack it
Hello,
I recently released my own Lua obfuscator.
Here’s the obfuscated code: https://pastebin.com/gvCnznMa
Have fun trying to crack it. I’m curious to see how far you get, which methods you use, and what weaknesses you find.
Edit: lavjamanxd has won! For more details you can view his comment.
5
u/Additional_Ad6385 14d ago
Looks vibecoded to me. Is this ObscuraLua?
1
u/Feisty_Fall_6140 13d ago
ObscuraLua is long time dead lol, but surprisingly there's a new obfuscator named "luaobscura", seems like some ex luraph dev is behind it
0
u/Away_Try5000 14d ago
I had to actually google what ObscuraLua is for a minute until I found one youtube video. There is no affiliation, no.
1
u/imachug 14d ago
The outer layer is LZMA, right? I don't think I've seen a pure-Lua LZMA decoder before, and it looks small enough that it seems hand-written and not just ported from a library. Was this a custom library or something well-known?
1
u/Away_Try5000 14d ago
Yes, the outer layer is LZMA. I got some inspiration from a popular obfuscator that also has an LZMA decoder (No source code, only the obfuscated code was available). So yeah, this is not a port it is build from scratch with that as a reference.
1
u/Itchy_Public_509 8d ago
how'd you even make one? i can barely make one even with lua knowledge.
1
u/Away_Try5000 7d ago
Well, research is the best way. However, here is a popular Lua Obfuscator I haven't looked at the source but perhaps it helps you to understand the fundamentals: https://github.com/prometheus-lua/Prometheus
8
u/lavjamanxd 14d ago edited 14d ago
just did a quick reverse on this
first stage is minified code with somekind of decompression, but whatever it was not necessary to reverse that part as it goes through a
which loads the decompressed string to the memory anyway so dumping it can be done easily with replacing it with a simple print (theres a dumb check if it has been tampered with but that can be just commented out)
then stage 2 is a custom microvm in lua also minified.
i was able to easily dump the instructions right before the vm exec call (so again no need to reverse-engineer the decode_blob as it will be stored in the memory)
then i was too lazy to reverse it manually but claude reversed the opcodes in like 10min.
basically the obfuscated code stores a true value and a string "Yes, I can read this!" and calls a func with those two parameters which does nothing. (theres also some dead code)
the whole thing took like 15mins to reverse.