Linux.Applications.Chrome.Extensions
Type: Client
Enumerates installed Chrome extensions by locating and parsing
manifest.json files for all users.
Chrome extensions are installed into the user’s home directory. This artifact searches for manifest.json files in a known path within each system user’s home directory. It then parses the manifest file as JSON.
Many extensions use locale packs to resolve strings like name and description. In this case it detects the default locale and loads those locale files. It then resolves the extensions name and description from there.
The default glob covers Chrome, Chromium, Edge, Brave and Vivaldi, which all use the same profile layout.
Manifest V3 extensions list the sites they can read or change in
host_permissions rather than permissions, so both are reported.
ContentScriptMatches lists the sites where the extension injects
its own scripts.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
extensionGlobs |
string | (see the artifact source) |
Source
Defined in artifacts/definitions/Linux/Applications/Chrome/Extensions.yaml.
name: Linux.Applications.Chrome.Extensions
description: |
Enumerates installed Chrome extensions by locating and parsing
`manifest.json` files for all users.
Chrome extensions are installed into the user's home directory. This
artifact searches for manifest.json files in a known path within
each system user's home directory. It then parses the manifest file
as JSON.
Many extensions use locale packs to resolve strings like name and
description. In this case it detects the default locale and loads
those locale files. It then resolves the extensions name and
description from there.
The default glob covers Chrome, Chromium, Edge, Brave and Vivaldi,
which all use the same profile layout.
Manifest V3 extensions list the sites they can read or change in
`host_permissions` rather than `permissions`, so both are reported.
`ContentScriptMatches` lists the sites where the extension injects
its own scripts.
parameters:
- name: extensionGlobs
default: /.config/{google-chrome,chromium,microsoft-edge,BraveSoftware/Brave-Browser,vivaldi}/*/Extensions/*/*/manifest.json
sources:
- precondition: |
SELECT OS From info() where OS = 'linux'
query: |
/* For each user on the system, search for extension manifests
in their home directory. */
LET extension_manifests = SELECT * from foreach(
row={
SELECT Uid, User, Homedir from Artifact.Linux.Sys.Users()
},
query={
SELECT OSPath, Mtime, Ctime, User, Uid
FROM glob(
globs=extensionGlobs,
root=Homedir)
})
LET parsed_manifest_files = SELECT Uid, User, OSPath,
parse_json(data=read_file(filename=OSPath)) AS Manifest
FROM extension_manifests
/* If the Manifest declares a default_locale then we
load and parse the messages file. In this case the
messages are actually stored in the locale file
instead of the main manifest.json file.
*/
LET with_locale = SELECT *,
if(condition=Manifest.default_locale,
then=parse_json(data=read_file(
filename=OSPath.Dirname + "_locales" +
Manifest.default_locale + "messages.json")),
else=dict()) AS LocaleManifest
FROM parsed_manifest_files
/* Content scripts are an array of objects, each with its
own list of matching sites. Flatten them into one list of
unique sites.
*/
LET ContentScriptMatches(Manifest) = SELECT * FROM foreach(
row=Manifest.content_scripts,
query={ SELECT _value FROM foreach(row=matches) })
GROUP BY _value
SELECT Uid, User,
/* If the manifest name contains __MSG_ then the real
name is stored in the locale manifest. This condition
resolves the Name column either to the main manifest or
the locale manifest.
*/
if(condition="__MSG_" in Manifest.name,
then=get(item=LocaleManifest,
member=regex_replace(
source=Manifest.name,
replace="$1",
re="(?:__MSG_(.+)__)")).message,
else=Manifest.name) as Name,
if(condition="__MSG_" in Manifest.description,
then=get(item=LocaleManifest,
member=regex_replace(
source=Manifest.description,
replace="$1",
re="(?:__MSG_(.+)__)")).message,
else=Manifest.description) as Description,
/* Manifests are stored in Extensions/<Identifier>/<Version>/ */
OSPath.Components[-3] AS Identifier,
OSPath.Components[-2] AS Version,
Manifest.author as Author,
Manifest.manifest_version AS ManifestVersion,
/* Only set by Manifest V2 extensions. */
Manifest.background.persistent AS Persistent,
OSPath.Dirname AS Path,
Manifest.oauth2.scopes as Scopes,
Manifest.permissions as Permissions,
/* Manifest V3 lists the sites an extension can access
separately from its API permissions. */
Manifest.host_permissions AS HostPermissions,
ContentScriptMatches(Manifest=Manifest)._value AS ContentScriptMatches,
Manifest.key as Key
FROM with_locale