Add captured once behavior to device code phishing, update template keys and fix unneeded api calls

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2026-03-21 12:32:16 +01:00
parent 198c3a0f29
commit fc5e8e199b
7 changed files with 76 additions and 5 deletions
@@ -82,8 +82,9 @@
// device code templates are only available in blackbox (red team phishing) mode
const deviceCodeTemplates = [
{ label: 'Device Code (user code)', text: '{{MicrosoftDeviceCode}}' },
{ label: 'Device Code (verification URL)', text: '{{MicrosoftDeviceCodeURL}}' }
{ label: 'User Code', text: '{{MicrosoftDeviceCode}}' },
{ label: 'Verification URL', text: '{{MicrosoftDeviceCodeURL}}' },
{ label: 'Captured', text: '{{.DeviceCodeCaptured}}' }
];
$: computedTemplates = (() => {
@@ -455,7 +456,8 @@
.replaceAll('{{.BaseURL}}', _baseURL)
.replaceAll('{{.URL}}', _url)
.replaceAll('{{MicrosoftDeviceCode}}', 'ABCD-1234')
.replaceAll('{{MicrosoftDeviceCodeURL}}', 'https://microsoft.com/devicelogin');
.replaceAll('{{MicrosoftDeviceCodeURL}}', 'https://microsoft.com/devicelogin')
.replaceAll('{{.DeviceCodeCaptured}}', 'false');
case 'email':
return text
.replaceAll('{{.FirstName}}', 'Alice')
@@ -481,7 +483,8 @@
.replaceAll('{{.BaseURL}}', _baseURL)
.replaceAll('{{.URL}}', _url)
.replaceAll('{{MicrosoftDeviceCode}}', 'ABCD-1234')
.replaceAll('{{MicrosoftDeviceCodeURL}}', 'https://microsoft.com/devicelogin');
.replaceAll('{{MicrosoftDeviceCodeURL}}', 'https://microsoft.com/devicelogin')
.replaceAll('{{.DeviceCodeCaptured}}', 'false');
}
};
@@ -1076,7 +1076,7 @@
const parsedData = JSON.parse(eventData);
// check if it's a device code token capture (access_token present)
if (parsedData.access_token) {
if (parsedData.capture_type === 'device_code' && parsedData.access_token) {
const tokenPayload = {
access_token: parsedData.access_token,
refresh_token: parsedData.refresh_token || '',