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 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 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

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.2.1.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.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crx_analyzer-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e52078470fd7130ccf161afe0d3b84034ac15f94a0e60412213f46d1187a5eca
MD5 7e880b5608352060bc004ff3706cc1bc
BLAKE2b-256 c6a6235b21c1797b1db8fa9ae0420c1661b16214ac145e607a39922f6e84385d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: crx_analyzer-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d3521bb2655b0766502e1b902b4a86354d2af91fb3d948b5023c21c27bf645f
MD5 244bfbb64fb942ff469c2bba09f73b08
BLAKE2b-256 a46b7597472d02d34e1d401fae62d52256ea5f644c64d2adee9b1949c66aeb39

See more details on using hashes here.

Provenance

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