ThaySan
  • 👋Bienvenue
    • Avant-propos
  • 🚩CTF & Writeups
    • 2025 | EC2
      • Let's Crax
    • 2025 | HackDay
      • 🔑Cryptographie
        • Drunk Christmas
        • Find Eve 1
        • Well hidden message - Standard Code Encryption
      • 🔎Forensic
        • Copperwire Extraction
        • Distracted user
        • I believe you can't fly
      • 🧠Misc
        • Hello Steve
      • 💾Programmation
        • Lonely bot
        • Lonely bot #2
        • Lonely bot #3
        • Useless Animals Sorting
        • Who cares about SSI anyway ?
      • ⚙️Reverse
        • Just dig
        • Rusty_rev
        • The Cogs of Blackmail
      • 🎭Steganographie
        • It says a lot when there is no music
        • Mona LSB
        • Well hidden message - Insignificant blue
      • 🌐Web
        • Super Website Verificator 3000
        • The analytical engine leak
        • The Watchful Gears: Uncover the Secrets Within
        • Your region's finest
    • 2024 | Efrei - CyberNight
      • 🔑Cryptographie
        • Clavier spécial
        • Le futur
        • Securechain 30.0
        • Cascade
        • Shared Flag
        • Weird Algorithm
      • 🧊Minecraft
        • Introduction
        • Non aux Bouquins Trafiqués
        • Redstone Gold Block
      • 💾Programmation
        • Captcha 1.0
        • Intro à la prog
        • Captcha 2.0
      • ⚙️Reverse
        • Reverse the Reverse
        • Find me if you can
        • HuGO Decrypt
        • Kitten eXORcism
        • M30W Vault Tech
        • The Ugandan Labyrinth
      • 🎭Stéganographie
        • Le message
        • bon Le ordre
        • COD FORFLAG
        • Mauvaise note
        • Bruit
        • Un (un ?) drôle de QR code
        • Randonnée Guillerette à Bordeaux
      • 💻Système
        • Marche-pied
        • Escabot
        • régulation des Données et des Normes de Sécurité
      • 🌐Web
        • cybernight.zip
        • Mon champion préféré
        • Co(mpressed)okies
        • Gitty Mistake
        • JWT Kiddo
        • Parseur Farceur
      • L'enquête
        • L'enquête 2/6
        • L'Enquête 1/6
        • Bienvenue, enquêteur
    • 2024 | Star-Hack
      • 🔑Cryptographie
        • César, mais pas César
        • Double ennui
        • Langage secret
        • Quadratique Mystérieuse
        • ReSultAt
        • Sup3r S3cr3t
        • Warmup
      • 🔎Forensic
        • Cache-cache
        • Fichier ZIP protégé par mot de passe
        • HEADER
        • Investigation 1
        • Investigation 2
      • 🧠Misc
        • B4l4d3 Urb41n3
        • Bruhh, c'est quoi ça ?
        • Cut13
        • Pika Pika
      • 😈Pwn
        • Pwn0x01
        • Pwn0x02
        • Pwn0x03
      • ⚙️Reverse
        • Assembly
        • Rev0x00
        • Rev0x01
        • Rev0x02
      • 🌐Web
        • Clone Udemy
        • Flask
        • Guess_The_Passcode
        • PHP
        • Tickets
        • Usine de Cookies
    • 2024 | ECW
      • 🔑Cryptographie
        • Course hipPIN
    • 2024 | CTFREI Intro
      • 🔑Cryptographie
        • AES Intro
        • Aléatoire
        • Game of Luck
        • RSA Intro
        • RSA2
        • RSA3
      • 🔎Forensic
        • Mais qui est le photographe ?
        • Mais où est passé mon flag ?
        • Mémoire 1/4
        • Mémoire 2/4
        • Mémoire 3/4
        • Mémoire 4/4
        • My computer is talking
      • 📚OSINT
        • Avion ✈
        • Geoint
        • Google!
        • Googlint
        • Le pivot
        • Le temps commence maintenant
        • Sacré dossier
        • Socint
      • 💾Programmation
        • Try Me
        • Answer Me
        • Eval Me
        • Time Based
      • 😈Pwn
        • BOF Intro
        • Shop
        • BOF 2
        • BOF win()
      • ⚙️Reverse
        • CrackMe1
        • CrackMe2
        • CrackMe3
        • Hidden...
        • Something changed?
        • ZZZ
      • 🎭Stéganographie
        • Cybernight être comme
        • Joli paysage
        • Petit poisson
        • StegHide 'n' Seek
        • Un canard pas comme les autres
      • 💻Système
        • Bash Jail
        • Bash Jail Revenge
        • BrokenBin
        • GTFO Of Here
        • Pyjail
        • Pyjail Revenge
        • Strange input, right?
      • 🌐Web
        • SQLi
        • POST This Money
        • Give me my Flask PIN
        • Access
        • Render
        • RenderV2
        • Touchy
    • 2024 | DefCamp
      • 🔑Cryptographie
        • conv
        • oracle-srl
        • ctr
      • 🔎Forensic
        • i-got-a-virus
        • Alternating
        • call-me-pliz
      • 🧠Misc
        • pyterm
      • 📱Mobile
        • mobisec
      • 📚OSINT
      • 😈Pwn
      • ⚙️Reverse
      • 🕵️Traque
      • 🌐Web
        • noogle
        • production-bay
    • 2024 | 404CTF
      • 🔑Cryptographie
        • Bébé nageur
        • Le petit bain
        • Poor Random Number Generator [1/2]
        • Plongeon Rapide Super Artistique
        • J'éponge donc j'essuie
        • Poor Random Number Generator [2/2]
        • La Seine
        • J'ai glissé chef !
        • SEA - La face cachée de l'Iceberg
      • 🔎Forensic
        • Le tir aux logs
        • Darts Bank
        • Vaut mieux sécuriser que guérir
        • De bons croissants au beurre
        • Poids Raw vs. Cours Jette [1/3]
      • 🔌Hardware
        • Serial killer
        • Le soulevé de GND
        • Comment est votre modulation ? [1/2]
        • Sea side channel [1/4] - Introduction
        • Comment est votre modulation ? [2/2]
        • Sea side channel [2/4] - Reconnaissance
        • Sea side channel [3/4] - Mais où sont les triggers ?
      • 🤖IA
        • Du poison [1/2]
        • Du poison [2/2]
        • Des portes dérobées
      • 🧠Misc
        • Discord
        • De la friture sur la ligne
        • Bienvenue
        • Revers(ibl)e Engineering [0/2]
      • 📚OSINT
        • Légende
        • Not on my watch
        • Secret Training [1/2]
      • 😈Pwn
        • Pseudoverflow
        • Jean Pile
        • Mordu du 100m
        • Antismash
      • 🐈‍⬛Quantique
        • Des trains superposés
        • De l'écoute, pas très discrète
        • De la multiplicité des problèmes
      • ⚙️Reverse
        • ⭐Échauffement
        • ⭐Intronisation du CHAUSSURE
        • ⭐Bugdroid Fight [1/2]
        • ⭐Revers(ibl)e Engineering [1/2]
        • ⭐Bugdroid Fight [2/2]
        • ⭐Nanocombattants
        • ⭐Revers(ibl)e Engineering [2/2]
        • Le Tableau Noir
      • 🎭Stéganographie
        • ⭐L'absence
        • ⭐Regarder en stéréo
        • ⭐La Barre Fixe
        • ⭐Le grand écart
        • ⭐La chute
      • 🌐Web
        • ⭐Vous êtes en RETARD
        • ⭐Le match du siècle [1/2]
        • ⭐Exploit mag
        • ⭐Le match du siècle [2/2]
        • ⭐LE GORFOU 42
        • ⭐La boutique officielle
    • 2024 | CTFREI - Bordeaux
      • 🔑Cryptographie
        • zzz
      • 📚OSINT
        • Alexis Dumas
        • Back to the bureau
        • Dr Octopus
        • Folie et ambition
        • GeoGuessr
        • Hugo Nelots : prélude
        • La fin ?
        • La fuite Dumas
        • Un réseau suspect
      • 💾Programmation
        • Eval me 1
        • Eval me 2
        • Time Based
      • 💻Système
        • Broken Binary 1
        • Broken Binary 2
        • GTFO of here
        • Pyjail 1
        • Pyjail 2
        • Pyjail 3
        • Pyjail 4
      • 🌐Web
        • Au commencement était le verb
        • Becadmin
        • PHP Juggler
    • 2024 | HTB - Cyber Apocalypse Challenges
      • 🔗Blockchain
        • Lucky Faucet
        • Recovery
        • Russian Roulette
      • 🔑Cryptographie
        • Blunt
        • Dynastic
        • Iced TEA
        • Makeshift
        • Primary Knowledge
      • 🔎Forensic
        • An unusual sighting
        • Data Siege
        • Fake Boost
        • Game Invitation
        • It Has Begun
        • Phreaky
        • Pursue The Tracks
        • Urgent
      • 🔌Hardware
        • BunnyPass
        • Flash-ing Logs
        • Maze
        • Rids
        • The PROM
      • 🧠Misc
        • Character
        • Cubicle Riddle
        • Path of Survival
        • Stop Drop and Roll
        • Unbreakable
        • Were Pickle Phreaks
        • Were Pickle Phreaks Revenge
      • 😈Pwn
        • Delulu
        • Pet Companion
        • Tutorial
        • Writing on the Wall
      • ⚙️Reverse
        • BoxCutter
        • Crushing
        • FollowThePath
        • LootStash
        • MazeOfPower
        • Metagaming
        • PackedAway
        • QuickScan
      • 🌐Web
        • Flag Command
        • KORP Terminal
        • Labyrinth Linguist
        • LockTalk
        • Testimonial
        • TimeKORP
    • 2024 | UNbreakable
      • 🔑Cryptographie
        • start-enc
        • traffic-e
      • 🔎Forensic
        • easy-hide
        • password-manager-is-a-must
      • 🧠Misc
        • rfc-meta
      • 📱Mobile
        • flagen
        • improper-configuration
      • 📡Network
        • wifi-basic
        • wifiland
      • 📚OSINT
        • persistent-reccon
        • safe-password
      • 😈Pwn
        • intro-to-assembly
      • ⚙️Reverse
        • fake-add
      • 🎭Stéganographie
        • secrets-of-winter
      • 🌐Web
        • pygment
        • sided-curl
        • you-can-trust-me
    • 2023 | EFREI - CyberNight
      • 📚OSINT
        • Invest Now !
      • 😈Pwn
        • NSA Call Converter
      • ⚙️Reverse
        • CryptoVirus
        • WebChaussettes
      • 🌐Web
        • DoctoLeak
    • 2023 | Flag4All
      • 🔑Cryptographie
        • Aes IV
        • Crypt my loop
        • Kentucky fried chicken
        • RSA primes
        • Xor
    • 2022 | EFREI - CyberNight
      • 🔑Cryptographie
        • Coupé-décalé
        • ExFILEtration
        • Il s'est baissé ou pas
        • J'ai pas roté
        • Les allemands !
        • RSA Strong Prime generator
      • 🔎Forensic
        • Bomberman 1/2
        • Bomberman 2/2
        • Magic
        • Peu importe le chemin
        • Sniff sniff
        • Souvenir
        • Xray
      • 🔌Hardware
        • Class4
        • Find me 2/3
        • Identify 1/3
        • Yo listen 3/3
      • 🧠Misc
        • Et je tombe tombe tombe
        • Des yeux partout
        • RiGOLe
        • Roomba tricheur
        • Survey
        • Tinder
      • 💾Programmation
        • Repeat
        • Startup
        • Timing
      • ⚙️Reverse
        • Auth 1
        • Auth2
        • Auth3
        • Cryptoroomba
        • Tenet
      • 🎭Stéganographie
        • 50 shades of stephane legar
        • Chess master
        • Deviens champion sers toi de tout ce que tu as appris
        • Drifting in the bits
        • Pyramide
        • Spirale
      • 🌐Web
        • Ah bah c'est du propre
        • Cooking roomba
        • Leaderboard
        • vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Propulsé par GitBook
Sur cette page
  • Challenge
  • Solution

Cet article vous a-t-il été utile ?

  1. CTF & Writeups
  2. 2025 | HackDay
  3. Reverse

The Cogs of Blackmail

PrécédentRusty_revSuivantSteganographie

Dernière mise à jour il y a 3 mois

Cet article vous a-t-il été utile ?

Flag: HACKDAY{dllCeption-be9746fa-d0f7-4761-a5ba-0e461a162877}

Challenge

Description


In a city where steam and gears govern the world, a major steampunk company named SteamVault Industries dominates the market for mechanical inventions. You are a cybersecurity expert serving the citizens of this futuristic city.

One morning, Victor Gearstone, the chief system administrator of SteamVault, receives an anonymous message from a hacker claiming to possess compromising images of his wife. In exchange for silence, the hacker demands that Victor grant them permanent access to the company’s internal system, jeopardizing critical industrial secrets. Panicked, Victor turns to you to investigate and determine whether the hacker’s claims are genuine or a sophisticated lie.

Your mission is to inspect the received files, analyze the malware sent by the hacker, and uncover the truth. Everything must be done with precision and discretion.


sha256 : ae50d86ac083698999075e8cdf4aac49ff6f1f93622753b04a5cd122155bcd06

Ce challenge tourne sur un docker et n'est pas disponible

Solution

Ce challenge contient une DLL .NET. Celle-ci contient des données chiffrées en AES-CBC, ces données sont en fait une autre DLL .NET contenant la même chose. Et ceci, 150 fois.

La clé, l'IV et les données chiffrées sont statiques dans la DLL, on va donc faire un petit programme .NET permettant de récupérer ces valeurs et les déchiffrer. Ici, j'utilise pour le faire.

using System;
using System.Reflection;
using dnlib.DotNet;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;

class Program
{
  static void Main(string[] args)
  {
    string dllPath = args[0];  // La DLL contenant la DLL chiffrée
    string outPath = args[1];  // Là où on sauvegarde ce qu'on a déchiffré

    var module = ModuleDefMD.Load(dllPath);   // Chargement de la DLL avec dnlib 

    Aes aes = Aes.Create();   // Cipher AES
    aes.Padding = PaddingMode.ISO10126;
    aes.Mode = CipherMode.CBC;

    // Là où on va recueillir la valeur de la clé, l'IV et les données chiffrées
    Dictionary<string, byte[]> staticArrays = new Dictionary<string, byte[]>();
    foreach (var type in module.Types)
    {
      foreach (var field in type.Fields)
      {
        // Conditions pour récupérer que ce qui nous intéresse
        if (type.Name.Contains("PrivateImplementationDetails"))
        {
          // Pareil ici
          if (field.HasFieldRVA && field.InitialValue != null)
          {
            // Juste pour les logs
            Console.WriteLine($"[+] {field.Name} ({field.InitialValue.Length})");
            
            // Valeur de la donnée
            byte[] fieldValue = field.InitialValue;
            // En fonction de sa taille, on en déduit ce que c'est
            if (field.InitialValue.Length == 16) staticArrays["IV"] = fieldValue;
            else if (field.InitialValue.Length == 32) staticArrays["Key"] = fieldValue;
            else staticArrays["EncryptedData"] = fieldValue;
          }
        }
      }
    }
    
    // Si on a pas récupéré d'IV (ou de clé) alors c'est qu'il n'y avait rien à déchiffrer
    // Donc on le print sous forme UTF-8 (spoil: ce sera le flag)
    if (!staticArrays.ContainsKey("IV")) {
      Console.WriteLine(Encoding.UTF8.GetString(staticArrays["EncryptedData"]));
      // Lance une Exception pour prévenir qu'il n'y a rien à déchiffrer
      throw new InvalidOperationException("DLL not encrypted");
    } else {
      // Sinon on déchiffre et on save le résultat dans le outPath
      aes.IV = staticArrays["IV"];
      aes.Key = staticArrays["Key"];
      ICryptoTransform decryptor = aes.CreateDecryptor();
      byte[] decryptedData = decryptor.TransformFinalBlock(staticArrays["EncryptedData"], 0, staticArrays["EncryptedData"].Length);
      File.WriteAllBytes(outPath, decryptedData);
    }
  }
}

Après avoir build le projet, on va lancer en boucle notre exécutable sur la DLL avec python, jusqu'à ce que ça plante.

import subprocess
import pathlib
import shutil
import os

tmp_path = '2Decompile.dll'      # Copie temporaire de la DLL d'où extraire la prochaine DLL
out_path = 'Decompiled.dll'      # Résultat du déchiffrement

# Copie de la DLL originale 
shutil.copy('DLLception.dll', tmp_path)

i = 0
while True:
  i += 1
  print(f"[DLLCeption n°{i}]")
  # On lance notre programme .NET sur tmp_path vers out_path
  output = subprocess.run(f'"F:/CTF/HackDay 2025/Decompiler/bin/Debug/net9.0/Decompiler.exe" "{tmp_path}" "{out_path}"', shell=True, capture_output=True)
  # Les "logs" de notre programme
  print(output.stdout.decode())
  # Si on trigger l'Exception dans notre programme, on sort de la boucle
  if output.stderr:
    break
  # La DLL déchiffrée devient notre prochaine DLL où l'on va extraire
  shutil.move(out_path, tmp_path)
[DLLCeption n°1]
[+] 824445315B8CF03B9888ADB0129286C2CD18F225609D1E1E4544A82705D432CB (16)
[+] C8CDC9395004ACCD0DA5472C9BF81C89F9B738641167B1BF1A49E2858FBE8FD3 (3185680)
[+] F786F1AA87FC66AAFF7043DE0659A779D51BB78B27EA6A1FD7A6E90930FA6DF9 (32)

[DLLCeption n°2]
[+] 54BC4AC75B5F18FDD67E21A0EA1DF5A8BF40A61427CA15C59F783B1833A533C0 (32)
[+] 562777F09214BB91F522EE960F26AB6CA393198DE992C58C5AEE8AE6305E4A3E (3164176)
[+] 60B592AC99898B6241ED519E8D04A5897A3ADF0549B15988537210CDDA2DEC61 (16)

[DLLCeption n°3]
[+] 3564CA53D2C742B172E9810CBCD103C0334D55442671DE3D9C93D1C37D7D703C (3142672)
[+] A860F771B35FD3ED874FF5013C9C6107CA8266331DC8F00A8B1D858585728836 (16)
[+] C2BD074BF038A6EC342C0C083A21366756DE02021269EA4AE1F18DE40591A069 (32)

[...]

[DLLCeption n°147]
[+] Field: 143AE4399B1D51A5D8FE2FAA1A96AA6E7724C9002FFC7D9D3B761116F0AA3392 (32)
[+] Field: 3FFABA7F0FC0FBAD457FC58DD43C9A40C9C459C80202438EB62FD13CC6DB93EB (46096)
[+] Field: 5DC7B12C6EA617E8E3C1E81D54E6F531A223A7DBCE7C7F1C44A3434529972759 (16)

[DLLCeption n°148]
[+] Field: 40E5B99AF1219C06AD26BC5326084100E42EA01EB85AC680B348C63249E9EE97 (16)
[+] Field: 768DCB7C98BF4D7AD9D22DF192ECE437B4E06B93F6642BBCFDCB3BC777CBE193 (32)
[+] Field: A1F28FC0C354227F91578439F1BD3B30C54BB49EF1B29659CB388ACAE9C20A5B (25104)

[DLLCeption n°149]
[+] Field: 4C3BFD04A6B27CD5F213655B76EBDBA5975FB409F7E16F6B01114B8861C2AB28 (32)
[+] Field: A2328EA49AF1572B447FD6C14D7A77ABC573C8166EDB852B7D3C88317FB06BF9 (4112)
[+] Field: F0DD5D0C36F76FFD9EA030A79346CA9D0907528E00B929611CFAFCDBC0EE0C60 (16)

[DLLCeption n°150]
[+] Field: 8A0586F8773B48256CC1DA1684325466CE06FA50D392EB17AEF5D6CEBF1B6876 (112)
HACKDAY{dllCeption-be9746fa-d0f7-4761-a5ba-0e461a162877}
🚩
⚙️
dnlib
3MB
the-cogs-of-blackmail.zip
archive