Learn & practice AWS Hacking:<imgsrc="/.gitbook/assets/arte.png"alt=""data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<imgsrc="/.gitbook/assets/arte.png"alt=""data-size="line">\
Learn & practice GCP Hacking: <imgsrc="/.gitbook/assets/grte.png"alt=""data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<imgsrc="/.gitbook/assets/grte.png"alt=""data-size="line">](https://training.hacktricks.xyz/courses/grte)
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
IBM MQ ni teknolojia ya IBM ya kusimamia foleni za ujumbe. Kama teknolojia nyingine za **message broker**, inakusudia kupokea, kuhifadhi, kuchakata na kuainisha taarifa kati ya wazalishaji na watumiaji.
Kwa kawaida, **inaonyesha bandari ya TCP ya IBM MQ 1414**. Wakati mwingine, API ya HTTP REST inaweza kuonyeshwa kwenye bandari **9443**. Vipimo (Prometheus) vinaweza pia kufikiwa kutoka bandari ya TCP **9157**.
Zana inayopendekezwa kwa matumizi rahisi ni **[punch-q](https://github.com/sensepost/punch-q)**, kwa matumizi ya Docker. Zana hii inatumia maktaba ya Python `pymqi`.
Kwa njia ya zaidi ya mikono, tumia maktaba ya Python **[pymqi](https://github.com/dsuch/pymqi)**. [IBM MQ dependencies](https://www.ibm.com/support/fixcentral/swg/selectFixes?parent=ibm%7EWebSphere&product=ibm/WebSphere/WebSphere+MQ&release=9.0.0.4&platform=All&function=fixId&fixids=9.0.0.4-IBM-MQC-*,9.0.0.4-IBM-MQ-Install-Java-All,9.0.0.4-IBM-MQ-Java-InstallRA&useReleaseAsTarget=true&includeSupersedes=0&source=fc) zinahitajika.
1. Unda akaunti (IBMid) kwenye [https://login.ibm.com/](https://login.ibm.com/).
2. Pakua maktaba za IBM MQ kutoka [https://www.ibm.com/support/fixcentral/swg/selectFixes?parent=ibm%7EWebSphere&product=ibm/WebSphere/WebSphere+MQ&release=9.0.0.4&platform=All&function=fixId&fixids=9.0.0.4-IBM-MQC-*,9.0.0.4-IBM-MQ-Install-Java-All,9.0.0.4-IBM-MQ-Java-InstallRA&useReleaseAsTarget=true&includeSupersedes=0&source=fc](https://www.ibm.com/support/fixcentral/swg/selectFixes?parent=ibm%7EWebSphere&product=ibm/WebSphere/WebSphere+MQ&release=9.0.0.4&platform=All&function=fixId&fixids=9.0.0.4-IBM-MQC-*,9.0.0.4-IBM-MQ-Install-Java-All,9.0.0.4-IBM-MQ-Java-InstallRA&useReleaseAsTarget=true&includeSupersedes=0&source=fc). Kwa Linux x86_64 ni **9.0.0.4-IBM-MQC-LinuxX64.tar.gz**.
6. Kisha, ongeza kwa muda faili za `.so` kwenye LD: `export LD_LIBRARY_PATH=/opt/mqm/lib64`, **kabla** ya kutumia zana nyingine zinazotumia utegemezi hizi.
Kisha, unaweza kunakili mradi [**pymqi**](https://github.com/dsuch/pymqi): ina vipande vya msimbo vya kuvutia, constants, ... Au unaweza kufunga maktaba moja kwa moja kwa: `pip install pymqi`.
Inatokea kwamba baadhi ya mifano ya IBM MQ zinakubali maombi ya MQ **yasiyo na uthibitisho**, hivyo `--username / --password` hazihitajiki. Kwa hakika, haki za ufikiaji pia zinaweza kutofautiana.
> Maelezo machache kabla ya kuendelea: IBM MQ inaweza kudhibitiwa kwa njia nyingi: MQSC, PCF, Command ya Kudhibiti. Orodha za jumla zinaweza kupatikana katika [nyaraka za IBM MQ](https://www.ibm.com/docs/en/ibm-mq/9.2?topic=reference-command-sets-comparison).
> [**PCF**](https://www.ibm.com/docs/en/ibm-mq/9.3?topic=commands-introduction-mq-programmable-command-formats) (***Mifumo ya Amri Inayoweza Kuprogramishwa***) ndiyo tunayoangazia ili kuingiliana kwa mbali na mfano. **punch-q** na zaidi **pymqi** zinategemea mwingiliano wa PCF.
> Amri moja ya kuvutia ni `MQCMD_CREATE_SERVICE` na nyaraka zake zinapatikana [hapa](https://www.ibm.com/docs/en/ibm-mq/9.3?topic=formats-change-copy-create-service-multiplatforms). Inachukua kama hoja `StartCommand` inayotaja programu ya ndani kwenye mfano (mfano: `/bin/sh`).
> Pia kuna onyo la amri katika nyaraka: *"Kumbuka: Amri hii inaruhusu mtumiaji kuendesha amri yoyote kwa mamlaka ya mqm. Ikiwa haki za kutumia amri hii zitatolewa, mtumiaji mbaya au asiye makini anaweza kufafanua huduma ambayo inaharibu mifumo yako au data, kwa mfano, kwa kufuta faili muhimu."*
> *Kumbuka: kila wakati kulingana na nyaraka za IBM MQ (Marejeo ya Usimamizi), pia kuna kiunganishi cha HTTP kwenye `/admin/action/qmgr/{qmgrName}/mqsc` ili kuendesha amri sawa ya MQSC kwa ajili ya uundaji wa huduma (`DEFINE SERVICE`). Kipengele hiki hakijajadiliwa hapa bado.*
**Kumbuka kwamba uzinduzi wa programu ni wa asenkroni. Hivyo unahitaji kipengele cha pili ili kutumia exploit** ***(listener kwa ajili ya reverse shell, uundaji wa faili kwenye huduma tofauti, uhamasishaji wa data kupitia mtandao ...)**
Unaweza kuchimba katika nyaraka za IBM MQ na kutumia moja kwa moja maktaba ya **pymqi** ya python ili kujaribu amri maalum za PCF ambazo hazijatekelezwa katika **punch-q**.
Ikiwa huwezi kupata majina ya kudumu, unaweza kurejelea [nyaraka za IBM MQ](https://www.ibm.com/docs/en/ibm-mq/9.3?topic=constants-mqca-character-attribute-selectors).
> *Mfano wa [`MQCMD_REFRESH_CLUSTER`](https://www.ibm.com/docs/en/ibm-mq/9.3?topic=formats-mqcmd-refresh-cluster-refresh-cluster) (Decimal = 73). Inahitaji parameter `MQCA_CLUSTER_NAME` (Decimal = 2029) ambayo inaweza kuwa `*` (Doc: ):*
Kwa default, uthibitishaji umewezeshwa, jina la mtumiaji ni `admin` na nenosiri ni `passw0rd` (Kigezo cha mazingira `MQ_ADMIN_PASSWORD`). Hapa, jina la meneja wa foleni limewekwa kuwa `MYQUEUEMGR` (kigezo `MQ_QMGR_NAME`).