The Chronicles of Greg (Not Solved, Raw Thoughts)

[★★☆] SystemUpdate incident report

Description

Greg didn’t ask for this. Greg wanted a quiet Friday, maybe a donut, and ideally no malware. But no. Instead, Greg found logs—weird logs. And when Greg sees weird logs, Greg investigates. This is Greg’s story.

############

Analyst Log – 09:14 AM: "They called it a 'low-priority anomaly.' Said it was probably nothing. That’s what they always say before things explode". I ran strings on the file—didn’t like what I saw. Not an update. Not even ransomware. Just… vibes. Binary vibes. They’ve named it internally ‘SystemUpdate.’ I don’t know why. No update was done. I’m not even sure if this is about system update anymore.

############

system_updatearrow-up-right

Solution

➜ file .\system_update   
.\system_update: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b25880769b4dc53f70bfd0c86b8f7e567c843205, for GNU/Linux 3.2.0, stripped

Open in your favorite decompiler, like https://dogbolt.org/?id=2e418362-371e-406e-b061-880225a99210#Ghidra=1124&Hex-Rays=722arrow-up-right

FUN_00102070 seems to be the main function, mainly because of args that follow int argc, char* argv pattern.

The_Chronicles_of_Greg.png

FUN_00101e70 function is used to get command from user and then execute it via system call.

The_Chronicles_of_Greg-1.png

After some scrolling we see FUN_00101f50 function, which seems to be making C2 connection to server and most probably passing the COMMAND here:

The_Chronicles_of_Greg-2.png

Smth like:

Server seems to receive the connection:

Not so simple

Re-analyze the program:

  1. Send data to C2 server

  2. Get data from C2 server

  3. Parse COMMAND and store only what's after COMMAND:

    • If found, execute and finish

  4. Else make call to FUN_00101d20 (encryption funky stuff)

  5. Encryption requires seed __seed = get_seed("/lib/x86_64-linux-gnu/libc.so.6");:

The_Chronicles_of_Greg-3.png
  • If /lib/x86_64-linux-gnu/libc.so.6 is not found then it's current timestamp

  • If it's found then it's the mangled version number.

For me it would be following:

The decryption function looks like following~

The_Chronicles_of_Greg-4.png

To make decryption work we first need valid response from a server which doesn't start with COMMAND:

The_Chronicles_of_Greg-5.png

The entry function is also not very clear. sendarrow-up-right

The_Chronicles_of_Greg-6.png

Assumption that program starts with read was wrong, it starts by connecting to C2

There's a comparison which seems to block further execution of code. argv[1] needs to be correct value.

The_Chronicles_of_Greg-7.png

Left value is controlled by our input, right doesn't change. [0xF9, 0xFF, 0x8F, 0xE0, 0xEA, 0xC6, 0xFE, 0x2A, 0xCC, 0x9D, 0xE6, 0x9A, 0x92, 0xD3, 0xC4, 0xCB]

The_Chronicles_of_Greg-8.png

For IDC you can set breakpoint and then run these to show value comparison

Last updated