Skip to main content

Add your description here

Project description

crx-analyzer

PyPI version 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/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 stroes. 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 extensions 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 extensions. 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. Risk score in its current state should not be taken as absolute, but rather a potiential indicator. There will always be context outside the tool that will need to be considered.

URL extraction

Crx-analyzer can extract URLs from the extensions 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 if 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 chrome --output json

Development

Setup

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

Developement 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.2.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.2.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crx_analyzer-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 03ba1afd01e8f5f8abbba9108fb4b9d45561cd916114c2b3ca19cf83b2720ff0
MD5 4397b0e5c764c5680f0c3404b5e18299
BLAKE2b-256 dd7a0439fda6271eaf751b6b2bacb900e0b24fd812090e7c79a2ea3fdd83f41c

See more details on using hashes here.

Provenance

The following attestation bundles were made for crx_analyzer-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: crx_analyzer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb3e542818ee90013984ed8c413d6228d90a9059265633a1b5f13e646f266bed
MD5 3a90cc115631bad3c144b7ca921d8c4d
BLAKE2b-256 a1db1f25522db224e356a7bb2c72a8bf5211caad98c22f704374e60e63c73acc

See more details on using hashes here.

Provenance

The following attestation bundles were made for crx_analyzer-0.2.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