You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/network-services-pentesting/1414-pentesting-ibmmq.md
+99Lines changed: 99 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,14 @@ You can try to enumerate the **queue manager name, the users, the channels and t
70
70
71
71
If TCP/1414 is filtered or the target only exposes the embedded web server, check **TCP/9443** too. Recent IBM MQ versions expose the **IBM MQ Console / REST API** there by default when `mqweb` is enabled, and the administrative REST endpoint can execute arbitrary **MQSC** commands if you have valid credentials.
72
72
73
+
Do not limit yourself to the administrative REST API. IBM also exposes a **messaging REST API** on the same listener, so valid `mqweb` credentials can be enough to:
74
+
75
+
-**browse** messages from a queue with `GET /ibmmq/rest/v3/messaging/qmgr/<qmgr>/queue/<queue>/message`
76
+
-**destructively get** messages with `DELETE /ibmmq/rest/v3/messaging/qmgr/<qmgr>/queue/<queue>/message`
77
+
-**put** attacker-controlled messages with `POST /ibmmq/rest/v3/messaging/qmgr/<qmgr>/queue/<queue>/message`
78
+
79
+
That matters in real environments where **1414** is ACL-restricted but the web console on **9443** is reachable from jump hosts, VPN ranges, or Kubernetes ingress.
80
+
73
81
### Queue Manager
74
82
75
83
Sometimes, there is no protection against getting the Queue Manager name:
@@ -180,6 +188,43 @@ curl -sku 'admin:passw0rd' \
180
188
181
189
If you have enough rights to use PCF remotely, IBM exposes `MQCMD_INQUIRE_CHLAUTH_RECS`, which returns the channel authentication records and their mappings to `MCAUSER`. That is useful to confirm whether a channel maps remote users to a more privileged local account before trying message access, object creation, or service abuse.
182
190
191
+
### Effective authorities
192
+
193
+
Once you have a working identity, spend a minute checking **what that principal can really do** before assuming a failed PCF request means "wrong credentials". IBM documents three complementary ways to inspect OAM permissions:
194
+
195
+
-`DISPLAY AUTHREC` over MQSC
196
+
-`dspmqaut` on the host
197
+
-`MQCMD_INQUIRE_ENTITY_AUTH` over PCF
198
+
199
+
The practical offensive value is high because many remote-admin actions depend on a small set of system objects. For example, PCF administration usually needs the ability to put a command onto `SYSTEM.ADMIN.COMMAND.QUEUE` and to create/read the dynamic reply queue derived from `SYSTEM.DEFAULT.MODEL.QUEUE`.
There is a code snippet with **pymqi** (`dis_queues.py`) but **punch-q** permits to retrieve more pieces of info about the queues:
@@ -222,6 +267,43 @@ You can target queue(s)/channel(s) to sniff out / dump messages from them (non-d
222
267
223
268
**Do not hesitate to iterate on all identified queues.**
224
269
270
+
### Dump / put messages through `9443`
271
+
272
+
If you only have access to the embedded web server, the **messaging REST API** can still be enough to browse, steal, replay, or delete business messages without touching the MQ client port.
- the environment routes the MQ Console through a reverse proxy or ingress controller
305
+
- you want to validate **message tampering** separately from **administrative** rights
306
+
225
307
### Code execution
226
308
227
309
> Some details before continuing: IBM MQ can be controlled though multiple ways: MQSC, PCF, Control Command. Some general lists can be found in [IBM MQ documentation](https://www.ibm.com/docs/en/ibm-mq/9.2?topic=reference-command-sets-comparison).
@@ -301,6 +383,21 @@ This is especially useful during assessments where:
301
383
- The target team manages IBM MQ mainly through the web console and has forgotten to harden the REST roles
302
384
- You want to avoid installing IBM MQ client libraries locally and only need MQSC-level administration
303
385
386
+
If the environment uses **token-based** authentication instead of HTTP Basic, IBM's `mqweb` login endpoint returns an **`LtpaToken2`** cookie that can be replayed on later requests until it expires (120 minutes by default). That means a stolen browser session or cookie jar can be enough for both message access and admin actions on `9443`.
-[IBM MQ token-based authentication for the REST API](https://www.ibm.com/docs/en/ibm-mq/9.4.x?topic=security-using-token-based-authentication-rest-api)
0 commit comments