Cyber security

Technical Analysis Of BiBi – Windows Wiper Targeting Israeli Organizations

On 30th October, Security Joes Incident Response team discovered a new Linux Wiper named “BiBi-Linux” Wiper been deployed by Pro-Hamas Hacktivist group to destroy their infrastructure.

And then on November 1 2023, ESET Research tweeted about a Windows version of the Bibi Wiper deployed by BiBiGun, a Hamas-backed hacktivist group that initially debuted during the 2023 Israel-Hamas conflict.

In this post, we will look at the Windows version of the BiBi Wiper known as the “BiBi-Windows Wiper”

Technical Analysis

Upon execution, the BiBi-Windows Wiper checks to see if any arguments have been passed to the BiBi Wiper. The arguments here is the directory to be destroyed – bibi.exe <directory_to_destroyed>.

If no argument is provided, it performs the following routine for fetching the target drives

  • Reads the hardcoded path: “C:\Users”
  • Gets the currently available disk drives using GetLogicalDrives() where the return value is the bitmask, then it iterates through the A-Z (26) drives. It next does a bittest with the retrieved bitmask to determine the accessible drives on the system and appends “:\” to the drive name.
  • Here it excludes the C drive by checking for i != 2 where 2 is the bitmask position for C drive
  • Then for the available drives except the C drive it executes the GetDriveTypeA() which retrives the drive type, The BiBi-Windows Wiper here only targets the following drive types:
    • DRIVE_FIXED
    • DRIVE_REMOVABLE
    • DRIVE_RAMDISK

Therefore the BiBi-Windows Wiper targets

  • The hardcoded directory – “C:\Users”
  • And all available drives except from “C:” drive

Further it prints the target directories on the console and retrieves the NumberOfProcessors from GetNativeSystemInfo() and based on the numberofprocessors it calculates the threads and then prints it onto the console.

Further it creates a new thread which reads the commands stored in reverse, & then creates a new process using CreateProcessA to execute those commands. Following are the commands

  • cmd.exe /c bcdedit /set {default} recoveryenabled no – Disables Windows Recovery Environment
  • cmd.exe / c bcdedit / set {default} bootstatuspolicy ignoreallfailures – Force the system to boot normally rather than into the Windows Recovery Environment
  • cmd.exe /c wmic shadowcopy delete – Delete Volume Shadow Copies using WMIC
  • cmd.exe /c vssadmin delete shadows /quIet /all – Delete Volume Shadow Copies using VssAdmin

Furthermore it creates another thread which executes of the Main Wiper routines. The Wiper routines perform the following actions

  • The Arguments to the Wiper Function are:
    • Arg1 – Path of the Directory to be destroyed (Could be provided by the Operator or retrived as explained before)
    • Arg2 – Number of threads
  • Then it initiates an infinite loop where the counter is the Round “[+] Round %d\n” value – therefore once the Wiper is executed it would keep destroying the data infinitely!
  • Further based on the number of threads, it creates multiple threads in a loop which execute the main Wiper function.
  • The BiBi-Windows wiper excludes the files with “.exe”, “.dll” and “.sys” extension

Wiper Function Analysis

Now lets understand how BiBi-Windows Wiper destroys the data on the machine.

  • The Wiper firsty walks through the directory to be encrypted recursively and then retrives the file size of the target files.
  • Then it executes the wiper function in loop against the target files based on the file size, where the second argument to the wiper function is “0xFF”
  • The Wiper function implements the Mersenne Twister PseudoRandom Number Generator Algorithm which generates random numbers as shown below.
  • The random number generated from the function sub_140008BF0() then performs modulus (%) with the value “0xFF + 1 = 100” and the output (remainder) of the modulus operation is the byte which is been overwritten in the target file byte by byte.

Example below against a file consisting of the data “hello” and is been overwritten by these 5 random bytes in a loop.

ogfile_val -> rand_num % (hardcoded_val + 1) -> overwrite_val

h - 0xDD9B40A5 % 0x100 -> 0xA5
e - 0x37905317 % 0x100 -> 0x17
l - 0x54B7A20C % 0x100 -> 0x0C
l - 0xDBD10533 % 0x100 -> 0x33
o - 0x18ED3C42 % 0x100 -> 0x42

File Overwritten with Random bytes – Destroyed!

Now once the data in the file is overwritten with random bytes and the file is been destroyed, the BiBi Wiper changes the name of the file in the following manner:

  • It calls the previous Mersenne Twister function again where the hardcoded argument this time is “0x3D”. So once the random number is generated it performs modulus with “0x3E” and the output (remainder) value is stored in the similar manner.
  • Further the output remainder value is been multiplied by 2 and then the value is indexed against a wide string as represented below
rand_no = twisterfunc()
remainder_output = rand_no % (0x3D + 1)
wide_string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
filename_byte = wide_string[remainder_output * 2]

Thus,
if random num = 0xC6D15D79
mod_out = 0xC6D15D79 % 0x3E => 0x31
offset = 0x31 × 0x2 = 0x62
so the 62nd indexed value in the wide string becomes one of the character for the filename. In this case the value is "n"

The same routine is been executed 0xA (10) times and all the indexed values are appended together forming the random file name eg. 1wnRvB6teT and then the extension “.BiBi” (Bibi is a nickname used for Israel’s Prime Minister, Benjamin Netanyahu) is added along the round number at the end in the following manner – <rand_filename>.BiBi

Therefore in the following manner the BiBi-Windows Wiper would destroy all the files in the target directories by overwriting the data in the files with random bytes, now as the loop

i.e the rounds are till infinity the Wiper will keep on overwriting the files multiple time recursively with random bytes till infinity and wont stop thus destroying the files on the machine completely!

BiBi-Windows Wiper execution showcasing the Target directory, CPU Cores, Threads, Round Number, Stats, and destroyed file with .BiBi extension

Tamil S

Tamil has a great interest in the fields of Cyber Security, OSINT, and CTF projects. Currently, he is deeply involved in researching and publishing various security tools with Kali Linux Tutorials, which is quite fascinating.

Recent Posts

Shadow-rs : Harnessing Rust’s Power For Kernel-Level Security Research

shadow-rs is a Windows kernel rootkit written in Rust, demonstrating advanced techniques for kernel manipulation…

2 weeks ago

ExecutePeFromPngViaLNK – Advanced Execution Of Embedded PE Files via PNG And LNK

Extract and execute a PE embedded within a PNG file using an LNK file. The…

3 weeks ago

Red Team Certification – A Comprehensive Guide To Advancing In Cybersecurity Operations

Embark on the journey of becoming a certified Red Team professional with our definitive guide.…

3 weeks ago

CVE-2024-5836 / CVE-2024-6778 : Chromium Sandbox Escape via Extension Exploits

This repository contains proof of concept exploits for CVE-2024-5836 and CVE-2024-6778, which are vulnerabilities within…

4 weeks ago

Rust BOFs – Unlocking New Potentials In Cobalt Strike

This took me like 4 days (+2 days for an update), but I got it…

4 weeks ago

MaLDAPtive – Pioneering LDAP SearchFilter Parsing And Security Framework

MaLDAPtive is a framework for LDAP SearchFilter parsing, obfuscation, deobfuscation and detection. Its foundation is…

4 weeks ago