18 comments

  • kstrauser8 hours ago
    Story time: I worked the night shift at a motel during college. &quot;Bored to tears&quot; was an understatement. I was poking around the front desk computer system one night, as one does, and found its data file. Lacking anything else to do, I wrote a little hex dumper in BASIC so I could explore the file. The first thing I noted was that customer names were spaced exactly N bytes apart. Oooh, fixed records! Then I spent the next week or so reverse engineering the DB file format. I&#x27;d twiddle a field in a random customer record then look at their record in the hex dump to see what changed, then update my notes.<p>Eventually I wrote another little BASIC program to run analytics, like which customers spent the most with us, and auto-fix mistyped names (&quot;This says &#x27;Bb Jones&#x27;. Did you mean &#x27;Bob Jones&#x27;?&quot;) by writing directly to the file.<p>I got a pretty sweet little bonus for my hackery.
    • noduerme24 minutes ago
      All was fun... sorry (about two decades younger) when I was a junior web designer in the late 90s, keyword <i>designer</i>, not coder, I got approached with a freelance job to build an online store, which I knew nothing about doing. I knew some PHP, mainly how to write stuff in and out of files and inline variables into html. Naturally, I said yes to the job even though I was totally unqualified. I mean, who was qualified? I had to build a whole login portal from scratch for them to upload products, and images of the products, and sub-sub-products, and add-ons and prices and descriptions, and then have all of that reflect on the public website where people would buy them by adding them to a shopping cart which was basically a very long GET query that kept getting added to.<p>So but words like &quot;database&quot; and &quot;sql&quot; scared the shit out of me at the time. I was doing most of my coding out of a starbucks in Eagle Rock and there was one other guy there on a laptop, John P, who kept looking at what I was writing and telling me I had to learn databases.<p>What I ended up coding was basically a database based on text files and pages and a custom encoding methods and a system for locking. Imagine a year later in 1999 when I realized this had all been solved and I&#x27;d been too stubborn to try it or understand what it did...<p>Fast forward a few years and someone put two sequential asterisks in in the name of a product and blew up the site and my encoding system, since they&#x27;d accidentally stumbled on the row break symbol. lol. Good times.
    • threecheese5 hours ago
      I did something just like this at my first post-college job in the 90s. I found some weird backup files on the NT LAN, had similar observations as you, but wrote my extractor in C (casting records into structs - my first C program) using a “bcc” floppy disk. Turned out to be the entire insurance company Btrieve database, which I could dump into csv to load into MS Access.<p>This “database” allowed me to automate nearly my entire job - finding and exercising test cases for policy bug reports with a calculator - which gave me time to experiment with software development. I’d gone to college to be a writer, but this was waaaay cooler.<p>I didn’t get a bonus - heck I’d have been fired for sure - but that time spent learning made my entire career possible. Hoping to get another ten years before AI eats it all.
      • vismit20002 hours ago
        Another ten years - really optimistic! :)
    • inventor77776 hours ago
      How did your program suggest auto-fixed names? A manually entered list of common names, or did it go by previous records?<p>BASIC is over 40 years older than me, and I have never played with it, thus my question :-)
      • kstrauser2 hours ago
        BASIC, while not a language I&#x27;d use for any reason today, is Turing complete. You can write any program in BASIC that you could write in Rust. Of course, you&#x27;d mainly do that for the same reason you&#x27;d write something in, say, Brainfuck: mainly to see if you can. But when that&#x27;s all we had, we could get pretty creative with it.<p>It went by previous records. I&#x27;d read something about Levenshtein distance somewhere, and implemented my own half-assed version of it that was surely slower, more complicated, and less accurate. It still got the job done, though. I showed it to a coworker, who described it as &quot;magic&quot;, and I floated on that compliment for a long time after.<p>I was pretty proud of it, although the resulting QBasic code was pretty awful in retrospect. It was probably my first commercial-scale project, built with the software that happened to ship with the computer.
        • inventor77772 hours ago
          That&#x27;s neat, thanks for explaining!
  • truekonrads4 hours ago
    My few rules are: 1) What&#x27;s the entropy? This helps with encrypted&#x2F;compressed. You probably need to overcome this? 2) What&#x27;s the context? Apps are developed in context and context suggests formats. Is it C? Then expect structs. Does it need to go over the wire? Expect run-length encodings. Python&#x2F;JS - JSON&#x2F;pickle. 3) There are broadly speaking only a few ways you can read data back into memory: fixed layout, run-length encoding, terminators. A great case-study is ASN.1, once you&#x27;ve built an ASN.1 parser by hand no file format will ever daunt you.
  • issung5 hours ago
    I finally dipped into using ImHex when doing some reversing of the PS2 memory card format for <a href="https:&#x2F;&#x2F;ps2iodb.com" rel="nofollow">https:&#x2F;&#x2F;ps2iodb.com</a>.<p>The program is so good, and has enough of a reputation that I knew to reach for it even though I know nothing about reversing, and that was 3-4 years ago now! Also shoutout to the awesome GUI library is uses; <a href="https:&#x2F;&#x2F;github.com&#x2F;ocornut&#x2F;imgui" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ocornut&#x2F;imgui</a>
  • Noxwizard4 hours ago
    I&#x27;m always on the lookout for a good hex editor. I&#x27;ve tried ImHex a few times and it doesn&#x27;t quite fit the need I have and I prefer HxD for the simple things. The Pattern Language is pretty neat, I hadn&#x27;t looked into that before. For the complicated things, it&#x27;s not always a linear process like in the case of the blog article. Mainly, there&#x27;s often lots of gaps in my structure until I figure them out. Some tools like ImHex or Kaitai, you can put in placeholder fields between two known objects, but that&#x27;s kind of annoying. 010 Editor lets you highlight and put colored bookmarks, which kind of works. The workflow I&#x27;ve ended up using for reversing in-memory data structures is to get a hexdump of the memory, take a screenshot and then put it in OneNote. Then I can draw colored boxes or highlight and put annotations off on the side with what things are or notes. If a field is a memory address to another related and unknown structure, I often will then get a short dump of that memory and put a screenshot of it on the same page with an arrow to it. It&#x27;s pretty kludgy, but I like the freeform nature of it. It&#x27;s basically a RE notebook, just without any useful RE built-ins. If anyone has ideas or recommendations on better discovery workflows, I&#x27;d love to hear them.
  • vivzkestrel3 hours ago
    - stupid question: do you have any ideas how to go about doing this on a .unr file<p>- it comes from a game called splinter cell conviction made in custom unreal 2.5<p>- I have neither been able to get UE-Explorer or UEViewer to work with it<p>- I can send you the file, I just want to know how to change enemy AI spawn types on it
    • NegativeLatency3 hours ago
      Try an LLM, either to do it directly or to guide your own explorations
      • vivzkestrel1 hour ago
        as a guy who doesnt have experience fiddling with this kinda stuff, what is the step by step process if any to go about figuring out how an unknown file format is actually made of and modifying it?<p>- the post itself quotes &quot;I usually couldn’t really give them a good answer except, “Look at the decompiled code of whatever program reads&#x2F;writes these files and work backwards from there.”<p>- i dont have the program and that is the real challenge
  • yapfrog6 hours ago
    I tried to do a similar thing last year to datamine a gacha game&#x27;s assets and somehow did it without knowing the existence of tools like IDA&#x2F;Ghidra. They&#x27;re using a custom db format that was XORed with a key. Iirc it was a bizarre format, it&#x27;s actually an archive where each column is a file containing all the rows of that column. So a table is just a folder full of these files. Maybe it&#x27;s a common thing idk. I got a partially working XOR key so I used ImHex to look at the partially decrypted db file and manually looked at the decrypted hex values to &quot;correct&quot; them.<p>I wish I read something like this article at that time!
  • jonhohle8 hours ago
    I’ve had a lot of luck with ImHex looking at various binary formats and even using it to aid in writing some file magic.<p>It would be really nice to be able to roundtrip C headers with it. The syntax is close, but often I older formats there is a 1:1 mapping with C structs that doesn’t quite match the imhex syntax.
    • Charon774 hours ago
      I use both ImHex and Kaitai struct, give it a try maybe you&#x27;ll like it
  • hmartin7 hours ago
    Spoiler: half the time, that unknown file format is a zip containing a sqlite db
    • userbinator2 hours ago
      The older the system&#x2F;the more changes it&#x27;s had, especially if it&#x27;s &quot;enterprise software&quot;, the more insane things tend to be; in one memorable case, it was a .zip containing JSON, which then contained base64-encoded XML, wrapping another base64-encoded .zip containing more XML, and in that XML was base16-encoded ASN.1 PER with the actual payload (encoded in a proprietary format). I won&#x27;t disclose specifics, but perhaps someone may recognise that from its description; suffice to say the industry that was related to started using computers in the days of mainframes and punched cards.
    • butvacuum6 hours ago
      for games its more often .net BinarySerializer.
      • Charon774 hours ago
        A lot of unity games does it, especially the &#x27;legacy&#x27; serializer
  • shitcoder3 hours ago
    Love imhex and recognised the author straight away. Used it plenty of times got save file reverse engineering to develop save editors
  • xiej7 hours ago
    I&#x27;ve been reverse engineering some old Minecraft Legacy Console Edition save files with ImHex and the pattern templates work pretty well, though debugging is sometimes painful (e.g. reading runtime-sized arrays can just overflow the file and error without showing previously decoded structs). Great tool though. LLMs are, of course, scarily good at reverse engineering and spotting patterns that take me way too much effort to spot.
  • cdbattags1 hour ago
    protobuf derivatives must be littered throughout<p>tbt to reverse engineering the original PokemonGo rpc
  • polishdude208 hours ago
    I&#x27;ve always wondered how something like an Autodesk Inventor sldprt file was formatted so that I could write a program to manipulate those files.<p>I assumed it was proprietary and left it at that.<p>A few years later, I saw that Onshape allows importing sldprt files into their system and I wonder how they were able to provide that ability without some proprietary knowledge transferred
  • Lucasoato8 hours ago
    I’m going to try that on the newest outlook binary format used to store the emails locally... why couldn’t they stick to the plain simple sqlite?
    • ChadNauseam7 hours ago
      Actually one of the worst and most insane file formats of all time. I partially reverse engineered it a while ago. My parser is super janky and I can&#x27;t share it, but I pasted the code into claude and had it summarize it: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;anchpop&#x2F;a14325cc451b04a5bf78c476ac20358c" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;anchpop&#x2F;a14325cc451b04a5bf78c476ac20...</a>
  • max9796 hours ago
    ImHex makes tackling proprietary formats so much less painful. Seriously a lifesaver for quickly mapping out structures.
  • thataccount8 hours ago
    If only it were BlackIce, it would be perfect.
  • throneitlol3 hours ago
    One trick that saves a lot of time before you write any pattern: generate two saves that differ in exactly one known way (buy one item, then diff), and byte-diff them. The changed offsets are usually the field you care about, and the size of the changed run tells you the width. Doing this a few times gives you a rough field map without guessing at structure.<p>The other thing worth checking early is whether the file is compressed or checksummed. If entropy is flat and high across the whole file it is probably deflate or an encrypted blob, and hex staring will get you nowhere until you unwrap it. And if there is a 4 byte value near the header or footer that changes on every save even when the data is identical, treat it as a CRC or timestamp before assuming it is data. Writing back an edited file that fails the checksum is the classic reason a patched save silently refuses to load.
  • basil_io5 hours ago
    [dead]
  • someperson9 hours ago
    Damn a video game spoiler warning, guess I can&#x27;t read the rest of the article.<p>I may feed it into an LLM to strip out the spoilers actually
    • monster_truck9 hours ago
      spoilers aren&#x27;t real, it&#x27;s like declaring you&#x27;re immune to propaganda only it actually works
    • odo12427 hours ago
      Unironically, this is a browser extension I wanna make lol