Skip to main content

Add your description here

Project description

crx-analyzer

GitHub Container Registry

crx-analyzer

[!IMPORTANT] crx-analyzer is still in development, breaking changes may occur. Please be aware of this when using the tool.

crx-analyzer is a Python tool for analyzing browser extensions through a risk management lens. It is designed to help you understand the risks associated with a browser extension and enable you to make informed decisions about whether to use it. In addition, it can also be used to aid analysts in hunting for potentially malicious extensions.

crx-analyzer was inspired by the crxcavator tool and uses some of the same risk scoring techniques, but is focused on providing a local, open-source implementation that won't have the risk of being taken down or no longer hosted.

The tool works by downloading the zipped extension file (.crx) from the respective browser's extension store and then extracting the files to a temporary directory. It parses the manifest.json file to get the extension's permissions and then uses basic pattern matching to extract URLs that are referenced in the extension's code.

crx-analyzer can be used by an analyst and supports a "pretty" output mode to accommodate this. crx-analyzer also supports a "json" output mode that allows for flexible usage in other tools or even in a CI/CD pipeline.

Installation

crx-analyzer is available on PyPI and GitHub container registry.

PyPI

pip install crx-analyzer

GitHub Container Registry

docker pull ghcr.io/rileydakota/crx-analyzer:latest

Features

Retrieval of Extensions from Browser Stores via ID

Crx-analyzer directly retrieves extensions from the browser stores. This eliminates the need to manually download the extension, or copy it from another machine in the case of a security investigation. Supported browsers are:

  • Chrome
  • Edge
  • Firefox (planned)
  • Safari (planned)
  • Brave (planned)

Metadata extraction and analysis of Permissions in Manifest.json

Crx-analyzer extracts important metadata from the manifest.json file, including: name, version, homepage, and author. It also calculates a SHA256 hash of the CRX file prior to decompressing it.

The extension's permissions are also extracted and analyzed. Crx-analyzer supports all known permissions fields (permissions, host_permissions, optional_permissions and optional_host_permissions). Permissions are categorized the same, regardless of being optional or required.

Risk score

Crx-analyzer provides a risk score based on the permissions and other metadata extracted from the extension. The current weights can be viewed in the risk.py file. Heavy inspiration was taken from the crxcavator tool. The score has a maximum value of 100.

Currently, the risk score only uses extension permissions, but in the future it will also use other metadata such as the extension's name, version, author, and information pulled from the browser web store. The risk score in its current state should not be taken as absolute, but rather as a potential indicator. There will always be context outside the tool that will need to be considered.

URL extraction

Crx-analyzer can extract URLs from the extension's code. This is done by using RegEx to find strings that match the pattern of a URL. Due to the nature of strings in JavaScript code, the URLs may contain additional characters that are not part of the URL itself. Currently, crx-analyzer does not attempt to clean these URLs, but this may be added in the future.

URLs will be matched regardless of whether they are in executable code or comments. Ultimately this feature is meant to be used as a starting point for further analysis, and not as a definitive source of URLs.

Usage

Get current version

crx-analyzer version

Analyze an extension from the Chrome Web Store

crx-analyzer analyze --id eaijffijbobmnonfhilihbejadplhddo --browser chrome --output pretty

Analyze an extension from the Edge Add-ons Store

crx-analyzer analyze --id eaijffijbobmnonfhilihbejadplhddo --browser edge --output pretty

Output extension results to json format

crx-analyzer analyze --id eaijffijbobmnonfhilihbejadplhddo --browser edge --output json

Show only permissions and metadata in pretty mode

crx-analyzer analyze --id eaijffijbobmnonfhilihbejadplhddo --browser edge --permissions

Limit the number of JavaScript files displayed to 20

crx-analyzer analyze --id eaijffijbobmnonfhilihbejadplhddo --browser edge --max-files 20

Development

Setup

  1. Install uv using one of these methods:
brew install uv
  1. setup pre-commit hooks
uv run pre-commit install

Development tasks

Run tests

uv run pytest

Linters and styling

uv run pre-commit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crx_analyzer-0.3.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crx_analyzer-0.3.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file crx_analyzer-0.3.0.tar.gz.

File metadata

  • Download URL: crx_analyzer-0.3.0.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for crx_analyzer-0.3.0.tar.gz
Algorithm Hash digest
SHA256 42bdc0f918b758c893cab64194589f2b6cf692b2def2b7672a5b7124678d2f37
MD5 9def8cbb58791d469fe37858d5841a86
BLAKE2b-256 a40bc531d35c2f3ce48d1754ac7cf5a74816e60e15d13cc98019f3f7bb0df5c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for crx_analyzer-0.3.0.tar.gz:

Publisher: release.yml on rileydakota/crx-analyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crx_analyzer-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: crx_analyzer-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for crx_analyzer-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9c27d2752fe4496a2dafef0e9c975b01b0586cc68d7f2d96cf80b9953c6f783
MD5 6ed29201aa511b75ef1632b8bd99a196
BLAKE2b-256 8f1f04308b20ba8501c995e5dcb4af90c716e86866947be953fe3ddf3e281a5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for crx_analyzer-0.3.0-py3-none-any.whl:

Publisher: release.yml on rileydakota/crx-analyzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page