Giter VIP home page Giter VIP logo

phish_oauth's Introduction

Netskope Threat Labs logo

Description

This project provides POC code to explore [OAuth 2.0](https://datatracker.ietf.org/doc/html/rfc6749)
authorization flows and how they can be abused in phishing attacks.

Specifically, we demonstrate a phishing attack using the device authorization grant
on Microsoft and intend to add additional flows as we go. An implementation of this 
is written in generic Powershell and can be run on any supported platform. Most cmdlet
calls are simple REST API calls and should be translateable to any language.

Running the Code

  1. Install Powershell 7.x
  2. Setup Microsoft Environments (for the victim only)
    1. NOTES:
      1. Victim environment setup: The attacker does not need a Microsoft account or environment, only the victim
      2. DO NOT run this in a production environment.
      3. Existing account: An existing Azure+Office365 account can be used, in which case just check that Azure+O365 access woorks for the existing accounts in steps 3 and 5.
      4. New account: These instructions are only needed if you want to create a new set of accounts to serve as the victim accounts.
      5. Admin privileges: You need administrator privileges to manage user accounts within Azure and Office 365.
      6. Trial accounts: this is the easiest way to create new accounts to test this POC (creating an O365 account should create the Azure account)
    2. AD Setup: Within Azure AD, login as an AD administrator and create victim account
      1. portal.azure.com > Azure Active Directory > Users
      2. ensure a subscription exists and some example resources exist that the user can access
    3. Check AD: Ensure the victim has read access to an Azure subscription and resources
      1. log into portal.azure.com as the victim, Search on subscriptions, should see at least 1
      2. search on All Resources, make sure at least one resource exists
      3. create some additional resources if you wish
    4. Office 365 Setup: Within the Office 365, login as the administrator and check that a license of Office 365 is associated with the victim
      1. login.onmicrosoft.com > Admin icon > Users > Active Users
    5. Check Office 365: Ensure the Office 365 Outlook email works for the victim
      1. login.onmicrosoft.com as the victim account > Outlook icon
  3. Configure demo_cfg.json
    • Set victim user email address in the "to" propery
    • Set SMTP settings if you want to have the demo code send an email phish
    • Keep other config settings as is (page=true, interactive=true, verbose=1, etc.)
  4. Run
    • command-line: Powershell.exe|pwsh demo_msft.ps1 -config demo_cfg.json
    • Step #0: user and device codes generated
    • Step #1: phish email sent (to user/victim set in demo_cfg.json)
    • Step #2: will loop waiting for user/victim to authenticate/authorize
    • In browser, <log in as user/victim to login.microsoft.com, check Outlook, follow phishing email link, authenticate)
    • Step #3: retrieve user''s oauth access tokens
    • Step #4: use access token to list users in Azure AD
    • Step #5: retrieve user''s email
    • Step #6: move laterally and use refresh token to get new access token for Azure
    • Step #7: will list resources within Azure subscriptions that the user/victim has access to

Directories / Files

device_code/pwsh/
    demo_msft.ps1       - main Powershell file. Usage: powershell|pwsh -h
    demo_cfg.json       - required config file
    demo_email.txt      - email template if sending phish email

OAuth Flows

Device Authorization Grant (device code flow)

Device Authorization Grant

References

  1. Evolving Phishing Attacks

  2. OAuth Device Code Flow

  3. Additional OAuth Research Areas

phish_oauth's People

Contributors

ns-jhwong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.