Skip to main content

authcodecatcher

A server for exchanging OAuth Codes for Tokens

Description

If an open or hijackable redirect URI is discovered for an entra application, authcodecatcher can serve as a server at the hijackable URL to catch auth codes and exchange them for tokens. The user will be redirected to the configurable landing page. PKCE is supported.

Installation

pip install authcodecatcher

Usage

First, an SSL certificate needs to be created if you don't have one already

openssl req -new -x509 -keyout cert.pem -out cert.pem -days 365 -nodes

Next, run the module with the required arguments

python3 -m authcodecatcher.server --client-id <ID of hijackable app registration> --tenant-id <target tenant ID> --redirect-uri <The hijackable URI that you control> --port <The port to listen on> --cert-file <The PEM certificate file created in the previous step>

Lastly, generate a URL that will be sent to the target

curl https://localhost:1337/generateurl

The output will be JSON with a URL that contains the authorization endpoint. If an authenticated user navigates to this URL, authcodecatcher will obtain the auth code and exchange it for an access token. All access tokens are saved to a JSON file 'tokens.json' by default.

Command Options

--redirect-uri

The hijackable URI that the attacker controls. Must be listed in the application registration.

--scope

The requested scope of the JWT. Defaults to https://graph.microsoft.com/.default+offline_access

--urlpath

The path of the redirect-uri. For example, if the redirect-uri is https://test.example.com/oauth/token, then the --urlpath should be set to /oauth/token.

--port

The port on which the server will listen

--client-id

The client ID (application ID) of the targeted Entra application.

--tenant-id

The target tenant ID

--output-file

The file that authcodecatcher will write tokens and pkce codes to.

--cert-file

The certificate file to use for SSL

--landing-page

The page that the user will be redirected to after the code exchange. Defaults to https://en.wikipedia.org/wiki/Snallygaster.

Metadata

Release files for authcodecatcher 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for authcodecatcher 0.1.1
File Size Uploaded
authcodecatcher-0.1.1.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for authcodecatcher 0.1.1
File Interpreter ABI Platform
authcodecatcher-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / authcodecatcher-0.1.1.tar.gz

Download URL authcodecatcher-0.1.1.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1679a30c84e3ef5c565f9c83cfb260e132fe145bf81a26e7f38995f25dfa9c69
BLAKE2b-256 checksum
How to use checksums
44672ca4cabb2c7e7665d4f1c09a0129be7a9085092448fa752928f9a0dc7e9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / authcodecatcher-0.1.1-py3-none-any.whl

Download URL authcodecatcher-0.1.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
181401317bc3d7cfeea58da6c644134594e460ef133d98c99bd5a93b91b6c0f2
BLAKE2b-256 checksum
How to use checksums
0f764b148e675b2280cf3ed28857321f944beb4e8e4f4d062097405d7bf96970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page