@cyclonedx/cdxgen 9.6.1 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/bin/cdxgen.js +1 -3
- package/bin/verify.js +19 -0
- package/binary.js +41 -10
- package/data/queries-win.json +200 -0
- package/data/queries.json +166 -15
- package/display.js +14 -8
- package/docker.js +18 -1
- package/evinser.js +23 -32
- package/index.js +38 -12
- package/package.json +4 -2
- package/utils.js +159 -85
- package/utils.test.js +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
cdxgen is a cli tool, library, [REPL](./ADVANCED.md) and server to create a valid and compliant [CycloneDX][cyclonedx-homepage] Software Bill-of-Materials (SBOM) containing an aggregate of all project dependencies for c/c++, node.js, php, python, ruby, rust, java, .Net, dart, haskell, elixir, and Go projects in JSON format. CycloneDX 1.5 is a lightweight SBOM specification that is easily created, human and machine-readable, and simple to parse.
|
|
6
6
|
|
|
7
|
-
When used with plugins, cdxgen could generate an
|
|
7
|
+
When used with plugins, cdxgen could generate an OBoM for Linux docker images and even VMs running Linux or Windows operating system. cdxgen also includes a tool called `evinse` that can generate component evidences and SaaSBoM for some languages.
|
|
8
8
|
|
|
9
9
|
NOTE:
|
|
10
10
|
|
|
@@ -127,9 +127,7 @@ Options:
|
|
|
127
127
|
-r, --recurse Recurse mode suitable for mono-repos. Defaults to
|
|
128
128
|
true. Pass --no-recurse to disable.
|
|
129
129
|
[boolean] [default: true]
|
|
130
|
-
-p, --print Print the SBoM as a table with tree.
|
|
131
|
-
true if output file is not specified with -o
|
|
132
|
-
[boolean]
|
|
130
|
+
-p, --print Print the SBoM as a table with tree. [boolean]
|
|
133
131
|
-c, --resolve-class Resolve class names for packages. jars only for n
|
|
134
132
|
ow. [boolean]
|
|
135
133
|
--deep Perform deep searches for components. Useful whil
|
|
@@ -294,6 +292,7 @@ cdxgen can retain the dependency tree under the `dependencies` attribute for a s
|
|
|
294
292
|
| MVN_CMD | Set to override maven command |
|
|
295
293
|
| MVN_ARGS | Set to pass additional arguments such as profile or settings to maven |
|
|
296
294
|
| MAVEN_HOME | Specify maven home |
|
|
295
|
+
| MAVEN_CENTRAL_URL | Specify URL of Maven Central for metadata fetching (e.g. when private repo is used) |
|
|
297
296
|
| GRADLE_CACHE_DIR | Specify gradle cache directory. Useful for class name resolving |
|
|
298
297
|
| GRADLE_MULTI_PROJECT_MODE | Unused. Automatically handled |
|
|
299
298
|
| GRADLE_ARGS | Set to pass additional arguments such as profile or settings to gradle (all tasks). Eg: --configuration runtimeClassPath |
|
|
@@ -366,15 +365,15 @@ systemctl --user start podman.socket
|
|
|
366
365
|
podman system service -t 0 &
|
|
367
366
|
```
|
|
368
367
|
|
|
369
|
-
### Generate
|
|
368
|
+
### Generate OBoM for a live system
|
|
370
369
|
|
|
371
|
-
You can use cdxgen to generate
|
|
370
|
+
You can use cdxgen to generate an OBoM for a live system or a VM for compliance and vulnerability management purposes by passing the argument `-t os`. Windows and Linux operating systems are supported in this mode.
|
|
372
371
|
|
|
373
372
|
```shell
|
|
374
373
|
cdxgen -t os
|
|
375
374
|
```
|
|
376
375
|
|
|
377
|
-
This feature is powered by osquery which is [installed](https://github.com/cyclonedx/cdxgen-plugins-bin/blob/main/build.sh#L8) along with the binary plugins. cdxgen would opportunistically try to detect as many components, apps and extensions as possible using the [default queries](queries.json). The process would take several minutes and result in an SBoM file with thousands of components.
|
|
376
|
+
This feature is powered by osquery which is [installed](https://github.com/cyclonedx/cdxgen-plugins-bin/blob/main/build.sh#L8) along with the binary plugins. cdxgen would opportunistically try to detect as many components, apps and extensions as possible using the [default queries](queries.json). The process would take several minutes and result in an SBoM file with thousands of components of various types such as operating-system, device-drivers, files, and data.
|
|
378
377
|
|
|
379
378
|
## Generating SaaSBoM and component evidences
|
|
380
379
|
|
package/bin/cdxgen.js
CHANGED
|
@@ -41,8 +41,7 @@ const args = yargs(hideBin(process.argv))
|
|
|
41
41
|
.option("print", {
|
|
42
42
|
alias: "p",
|
|
43
43
|
type: "boolean",
|
|
44
|
-
description:
|
|
45
|
-
"Print the SBoM as a table with tree. Defaults to true if output file is not specified with -o"
|
|
44
|
+
description: "Print the SBoM as a table with tree."
|
|
46
45
|
})
|
|
47
46
|
.option("resolve-class", {
|
|
48
47
|
alias: "c",
|
|
@@ -229,7 +228,6 @@ const checkPermissions = (filePath) => {
|
|
|
229
228
|
const bomNSData = (await createBom(filePath, options)) || {};
|
|
230
229
|
if (!args.output) {
|
|
231
230
|
args.output = "bom.json";
|
|
232
|
-
args.print = true;
|
|
233
231
|
}
|
|
234
232
|
if (
|
|
235
233
|
args.output &&
|
package/bin/verify.js
CHANGED
|
@@ -40,6 +40,25 @@ if (args.version) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const bomJson = JSON.parse(fs.readFileSync(args.input, "utf8"));
|
|
43
|
+
let hasInvalidComp = false;
|
|
44
|
+
// Validate any component signature
|
|
45
|
+
for (const comp of bomJson.components) {
|
|
46
|
+
if (comp.signature) {
|
|
47
|
+
const compSignature = comp.signature.value;
|
|
48
|
+
const validationResult = jws.verify(
|
|
49
|
+
compSignature,
|
|
50
|
+
comp.signature.algorithm,
|
|
51
|
+
fs.readFileSync(args.publicKey, "utf8")
|
|
52
|
+
);
|
|
53
|
+
if (!validationResult) {
|
|
54
|
+
console.log(`${comp["bom-ref"]} signature is invalid!`);
|
|
55
|
+
hasInvalidComp = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (hasInvalidComp) {
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
43
62
|
const bomSignature =
|
|
44
63
|
bomJson.signature && bomJson.signature.value
|
|
45
64
|
? bomJson.signature.value
|
package/binary.js
CHANGED
|
@@ -17,6 +17,7 @@ const isWin = _platform() === "win32";
|
|
|
17
17
|
|
|
18
18
|
let platform = _platform();
|
|
19
19
|
let extn = "";
|
|
20
|
+
let pluginsBinSuffix = "";
|
|
20
21
|
if (platform == "win32") {
|
|
21
22
|
platform = "windows";
|
|
22
23
|
extn = ".exe";
|
|
@@ -30,6 +31,13 @@ switch (arch) {
|
|
|
30
31
|
case "x64":
|
|
31
32
|
arch = "amd64";
|
|
32
33
|
break;
|
|
34
|
+
case "arm64":
|
|
35
|
+
pluginsBinSuffix = "-arm64";
|
|
36
|
+
break;
|
|
37
|
+
case "ppc64":
|
|
38
|
+
arch = "ppc64le";
|
|
39
|
+
pluginsBinSuffix = "-ppc64";
|
|
40
|
+
break;
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
// Retrieve the cdxgen plugins directory
|
|
@@ -46,14 +54,20 @@ if (
|
|
|
46
54
|
if (
|
|
47
55
|
!CDXGEN_PLUGINS_DIR &&
|
|
48
56
|
existsSync(
|
|
49
|
-
join(
|
|
57
|
+
join(
|
|
58
|
+
dirName,
|
|
59
|
+
"node_modules",
|
|
60
|
+
"@cyclonedx",
|
|
61
|
+
"cdxgen-plugins-bin" + pluginsBinSuffix,
|
|
62
|
+
"plugins"
|
|
63
|
+
)
|
|
50
64
|
) &&
|
|
51
65
|
existsSync(
|
|
52
66
|
join(
|
|
53
67
|
dirName,
|
|
54
68
|
"node_modules",
|
|
55
69
|
"@cyclonedx",
|
|
56
|
-
"cdxgen-plugins-bin",
|
|
70
|
+
"cdxgen-plugins-bin" + pluginsBinSuffix,
|
|
57
71
|
"plugins",
|
|
58
72
|
"goversion"
|
|
59
73
|
)
|
|
@@ -63,7 +77,7 @@ if (
|
|
|
63
77
|
dirName,
|
|
64
78
|
"node_modules",
|
|
65
79
|
"@cyclonedx",
|
|
66
|
-
"cdxgen-plugins-bin",
|
|
80
|
+
"cdxgen-plugins-bin" + pluginsBinSuffix,
|
|
67
81
|
"plugins"
|
|
68
82
|
);
|
|
69
83
|
}
|
|
@@ -88,7 +102,7 @@ if (!CDXGEN_PLUGINS_DIR) {
|
|
|
88
102
|
const globalPlugins = join(
|
|
89
103
|
globalNodePath,
|
|
90
104
|
"@cyclonedx",
|
|
91
|
-
"cdxgen-plugins-bin",
|
|
105
|
+
"cdxgen-plugins-bin" + pluginsBinSuffix,
|
|
92
106
|
"plugins"
|
|
93
107
|
);
|
|
94
108
|
if (existsSync(globalPlugins)) {
|
|
@@ -323,15 +337,21 @@ export const getOSPackages = (src) => {
|
|
|
323
337
|
}
|
|
324
338
|
}
|
|
325
339
|
const osReleaseData = {};
|
|
326
|
-
|
|
327
|
-
|
|
340
|
+
let osReleaseFile = undefined;
|
|
341
|
+
// Let's try to read the os-release file from various locations
|
|
342
|
+
if (existsSync(join(src, "etc", "os-release"))) {
|
|
343
|
+
osReleaseFile = join(src, "etc", "os-release");
|
|
344
|
+
} else if (existsSync(join(src, "usr", "lib", "os-release"))) {
|
|
345
|
+
osReleaseFile = join(src, "usr", "lib", "os-release");
|
|
346
|
+
}
|
|
347
|
+
if (osReleaseFile) {
|
|
328
348
|
const osReleaseInfo = readFileSync(
|
|
329
349
|
join(src, "usr", "lib", "os-release"),
|
|
330
350
|
"utf-8"
|
|
331
351
|
);
|
|
332
352
|
if (osReleaseInfo) {
|
|
333
353
|
osReleaseInfo.split("\n").forEach((l) => {
|
|
334
|
-
if (l.includes("=")) {
|
|
354
|
+
if (!l.startsWith("#") && l.includes("=")) {
|
|
335
355
|
const tmpA = l.split("=");
|
|
336
356
|
osReleaseData[tmpA[0]] = tmpA[1].replace(/"/g, "");
|
|
337
357
|
}
|
|
@@ -592,10 +612,11 @@ export const executeOsQuery = (query) => {
|
|
|
592
612
|
}
|
|
593
613
|
const args = ["--json", query];
|
|
594
614
|
if (DEBUG_MODE) {
|
|
595
|
-
console.log("
|
|
615
|
+
console.log("Executing", OSQUERY_BIN, args.join(" "));
|
|
596
616
|
}
|
|
597
617
|
const result = spawnSync(OSQUERY_BIN, args, {
|
|
598
|
-
encoding: "utf-8"
|
|
618
|
+
encoding: "utf-8",
|
|
619
|
+
maxBuffer: 50 * 1024 * 1024
|
|
599
620
|
});
|
|
600
621
|
if (result.status !== 0 || result.error) {
|
|
601
622
|
if (DEBUG_MODE && result.error) {
|
|
@@ -607,7 +628,17 @@ export const executeOsQuery = (query) => {
|
|
|
607
628
|
if (stdout) {
|
|
608
629
|
const cmdOutput = Buffer.from(stdout).toString();
|
|
609
630
|
if (cmdOutput !== "") {
|
|
610
|
-
|
|
631
|
+
try {
|
|
632
|
+
return JSON.parse(cmdOutput);
|
|
633
|
+
} catch (err) {
|
|
634
|
+
// ignore
|
|
635
|
+
if (DEBUG_MODE) {
|
|
636
|
+
console.log("Unable to parse the output from query", query);
|
|
637
|
+
console.log(
|
|
638
|
+
"This could be due to the amount of data returned or the query being invalid for the given platform."
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
611
642
|
}
|
|
612
643
|
return undefined;
|
|
613
644
|
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"win_version": {
|
|
3
|
+
"query": "select tb1.name, tb1.build_version, (case when (arch like '%-bit') then concat('x', replace(arch,'-bit', '')) else arch end) as arch, 'Microsoft' as publisher, tb2.version from (select name, version as build_version, arch from os_version) tb1,(select data as version from registry where path = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DisplayVersion') tb2;",
|
|
4
|
+
"name": "win_version",
|
|
5
|
+
"description": "Retrieves the name, version number, build version, and arch of the target Windows system.",
|
|
6
|
+
"purlType": "swid",
|
|
7
|
+
"componentType": "operating-system"
|
|
8
|
+
},
|
|
9
|
+
"kernel_info": {
|
|
10
|
+
"query": "select * from kernel_info;",
|
|
11
|
+
"name": "os-image",
|
|
12
|
+
"description": "Retrieves information from the current kernel in the target system.",
|
|
13
|
+
"purlType": "swid"
|
|
14
|
+
},
|
|
15
|
+
"chrome_extensions": {
|
|
16
|
+
"query": "select chrome_extensions.* from users join chrome_extensions using (uid);",
|
|
17
|
+
"description": "Retrieves the list of extensions for Chrome in the target system.",
|
|
18
|
+
"purlType": "swid"
|
|
19
|
+
},
|
|
20
|
+
"firefox_addons": {
|
|
21
|
+
"query": "select firefox_addons.* from users join firefox_addons using (uid);",
|
|
22
|
+
"description": "Retrieves the list of addons for Firefox in the target system.",
|
|
23
|
+
"purlType": "swid"
|
|
24
|
+
},
|
|
25
|
+
"browser_plugins": {
|
|
26
|
+
"query": "select browser_plugins.* from users join browser_plugins using (uid);",
|
|
27
|
+
"description": "Retrieves the list of C/NPAPI browser plugin in the target system.",
|
|
28
|
+
"purlType": "swid"
|
|
29
|
+
},
|
|
30
|
+
"ie_extensions": {
|
|
31
|
+
"query": "select ie_extensions.* from users join ie_extensions using (uid);",
|
|
32
|
+
"description": "Retrieves the list of extensions for IE in the target system.",
|
|
33
|
+
"purlType": "swid"
|
|
34
|
+
},
|
|
35
|
+
"opera_extensions": {
|
|
36
|
+
"query": "select opera_extensions.* from users join opera_extensions using (uid);",
|
|
37
|
+
"description": "Retrieves the list of extensions for opera in the target system.",
|
|
38
|
+
"purlType": "swid"
|
|
39
|
+
},
|
|
40
|
+
"safari_extensions": {
|
|
41
|
+
"query": "select safari_extensions.* from users join safari_extensions using (uid);",
|
|
42
|
+
"description": "Retrieves the list of extensions for safari in the target system.",
|
|
43
|
+
"purlType": "swid"
|
|
44
|
+
},
|
|
45
|
+
"python_packages": {
|
|
46
|
+
"query": "select * from python_packages;",
|
|
47
|
+
"description": "Python packages installed on system.",
|
|
48
|
+
"purlType": "pypi"
|
|
49
|
+
},
|
|
50
|
+
"windows_programs": {
|
|
51
|
+
"query": "select * from programs;",
|
|
52
|
+
"description": "Retrieves the list of products as they are installed by Windows Installer in the target Windows system.",
|
|
53
|
+
"purlType": "swid"
|
|
54
|
+
},
|
|
55
|
+
"windows_patches": {
|
|
56
|
+
"query": "select * from patches;",
|
|
57
|
+
"description": "Retrieves all the information for the current windows drivers in the target Windows system.",
|
|
58
|
+
"purlType": "swid"
|
|
59
|
+
},
|
|
60
|
+
"windows_drivers": {
|
|
61
|
+
"query": "select * from drivers;",
|
|
62
|
+
"description": "Retrieves all the information for the current windows drivers in the target Windows system.",
|
|
63
|
+
"purlType": "swid"
|
|
64
|
+
},
|
|
65
|
+
"windows_shared_resources": {
|
|
66
|
+
"query": "select * from shared_resources;",
|
|
67
|
+
"description": "Retrieves the list of shared resources in the target Windows system.",
|
|
68
|
+
"purlType": "swid",
|
|
69
|
+
"componentType": "data"
|
|
70
|
+
},
|
|
71
|
+
"appcompat_shims": {
|
|
72
|
+
"query": "SELECT * FROM appcompat_shims WHERE description!='EMET_Database' AND executable NOT IN ('setuphost.exe','setupprep.exe','iisexpress.exe');",
|
|
73
|
+
"description": "Appcompat shims (.sdb files) installed on Windows hosts.",
|
|
74
|
+
"purlType": "swid",
|
|
75
|
+
"componentType": "data"
|
|
76
|
+
},
|
|
77
|
+
"system_info_snapshot": {
|
|
78
|
+
"query": "SELECT * FROM system_info;",
|
|
79
|
+
"description": "System info snapshot query.",
|
|
80
|
+
"purlType": "swid",
|
|
81
|
+
"componentType": "data"
|
|
82
|
+
},
|
|
83
|
+
"pipes_snapshot": {
|
|
84
|
+
"query": "SELECT processes.path, processes.cmdline, processes.uid, processes.on_disk, pipes.name, pid FROM pipes JOIN processes USING (pid);",
|
|
85
|
+
"description": "Pipes snapshot query.",
|
|
86
|
+
"purlType": "swid",
|
|
87
|
+
"componentType": "data"
|
|
88
|
+
},
|
|
89
|
+
"services_snapshot": {
|
|
90
|
+
"query": "SELECT * FROM services;",
|
|
91
|
+
"description": "Services snapshot query.",
|
|
92
|
+
"purlType": "swid",
|
|
93
|
+
"componentType": "data"
|
|
94
|
+
},
|
|
95
|
+
"wmi_cli_event_consumers": {
|
|
96
|
+
"query": "SELECT * FROM wmi_cli_event_consumers;",
|
|
97
|
+
"description": "WMI CommandLineEventConsumer, which can be used for persistence on Windows. See https://www.blackhat.com/docs/us-15/materials/us-15-Graeber-Abusing-Windows-Management-Instrumentation-WMI-To-Build-A-Persistent%20Asynchronous-And-Fileless-Backdoor-wp.pdf for more details.",
|
|
98
|
+
"purlType": "swid",
|
|
99
|
+
"componentType": "data"
|
|
100
|
+
},
|
|
101
|
+
"wmi_filter_consumer_binding": {
|
|
102
|
+
"query": "SELECT * FROM wmi_filter_consumer_binding;",
|
|
103
|
+
"description": "Lists the relationship between event consumers and filters.",
|
|
104
|
+
"purlType": "swid",
|
|
105
|
+
"componentType": "data"
|
|
106
|
+
},
|
|
107
|
+
"wmi_cli_event_consumers_snapshot": {
|
|
108
|
+
"query": "SELECT * FROM wmi_cli_event_consumers;",
|
|
109
|
+
"description": "Snapshot query for WMI event consumers.",
|
|
110
|
+
"purlType": "swid",
|
|
111
|
+
"componentType": "data"
|
|
112
|
+
},
|
|
113
|
+
"certificates": {
|
|
114
|
+
"query": "SELECT * FROM certificates WHERE path != 'Other People';",
|
|
115
|
+
"description": "List all certificates in the trust store.",
|
|
116
|
+
"purlType": "swid",
|
|
117
|
+
"componentType": "data"
|
|
118
|
+
},
|
|
119
|
+
"wmi_event_filters": {
|
|
120
|
+
"query": "SELECT * FROM wmi_event_filters;",
|
|
121
|
+
"description": "Lists WMI event filters.",
|
|
122
|
+
"purlType": "swid",
|
|
123
|
+
"componentType": "data"
|
|
124
|
+
},
|
|
125
|
+
"etc_hosts": {
|
|
126
|
+
"query": "SELECT * FROM etc_hosts;",
|
|
127
|
+
"description": "List the contents of the Windows hosts file.",
|
|
128
|
+
"purlType": "swid",
|
|
129
|
+
"componentType": "data"
|
|
130
|
+
},
|
|
131
|
+
"scheduled_tasks": {
|
|
132
|
+
"query": "SELECT * FROM scheduled_tasks;",
|
|
133
|
+
"description": "List all scheduled_tasks.",
|
|
134
|
+
"purlType": "swid",
|
|
135
|
+
"componentType": "data"
|
|
136
|
+
},
|
|
137
|
+
"chocolatey_packages": {
|
|
138
|
+
"query": "SELECT * FROM chocolatey_packages;",
|
|
139
|
+
"description": "List all chocolatey_packages.",
|
|
140
|
+
"purlType": "chocolatey"
|
|
141
|
+
},
|
|
142
|
+
"npm_packages": {
|
|
143
|
+
"query": "SELECT * FROM npm_packages;",
|
|
144
|
+
"description": "List all npm_packages.",
|
|
145
|
+
"purlType": "npm"
|
|
146
|
+
},
|
|
147
|
+
"atom_packages": {
|
|
148
|
+
"query": "SELECT * FROM atom_packages;",
|
|
149
|
+
"description": "List all atom_packages.",
|
|
150
|
+
"purlType": "atom"
|
|
151
|
+
},
|
|
152
|
+
"startup_items": {
|
|
153
|
+
"query": "SELECT * FROM startup_items;",
|
|
154
|
+
"description": "List all startup_items.",
|
|
155
|
+
"purlType": "swid",
|
|
156
|
+
"componentType": "data"
|
|
157
|
+
},
|
|
158
|
+
"routes": {
|
|
159
|
+
"query": "SELECT * FROM routes;",
|
|
160
|
+
"description": "List all routes.",
|
|
161
|
+
"purlType": "swid",
|
|
162
|
+
"componentType": "data"
|
|
163
|
+
},
|
|
164
|
+
"listening_ports": {
|
|
165
|
+
"query": "SELECT * FROM listening_ports;",
|
|
166
|
+
"description": "List all listening_ports.",
|
|
167
|
+
"purlType": "swid",
|
|
168
|
+
"componentType": "data"
|
|
169
|
+
},
|
|
170
|
+
"processes": {
|
|
171
|
+
"query": "SELECT * FROM processes;",
|
|
172
|
+
"description": "List all processes.",
|
|
173
|
+
"purlType": "swid",
|
|
174
|
+
"componentType": "data"
|
|
175
|
+
},
|
|
176
|
+
"process_open_sockets": {
|
|
177
|
+
"query": "SELECT * FROM process_open_sockets;",
|
|
178
|
+
"description": "List all process_open_sockets.",
|
|
179
|
+
"purlType": "swid",
|
|
180
|
+
"componentType": "data"
|
|
181
|
+
},
|
|
182
|
+
"windows_update_history": {
|
|
183
|
+
"query": "SELECT * FROM windows_update_history;",
|
|
184
|
+
"description": "List all windows_update_history.",
|
|
185
|
+
"purlType": "swid",
|
|
186
|
+
"componentType": "data"
|
|
187
|
+
},
|
|
188
|
+
"windows_optional_features": {
|
|
189
|
+
"query": "SELECT * FROM windows_optional_features;",
|
|
190
|
+
"description": "List all windows_optional_features.",
|
|
191
|
+
"purlType": "swid",
|
|
192
|
+
"componentType": "data"
|
|
193
|
+
},
|
|
194
|
+
"windows_firewall_rules": {
|
|
195
|
+
"query": "SELECT * FROM windows_firewall_rules;",
|
|
196
|
+
"description": "List all windows_firewall_rules.",
|
|
197
|
+
"purlType": "swid",
|
|
198
|
+
"componentType": "data"
|
|
199
|
+
}
|
|
200
|
+
}
|
package/data/queries.json
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
+
"os_version": {
|
|
3
|
+
"query": "select * from os_version;",
|
|
4
|
+
"description": "Retrieves the current version of the running osquery in the target system and where the configuration was loaded from.",
|
|
5
|
+
"purlType": "swid",
|
|
6
|
+
"componentType": "operating-system"
|
|
7
|
+
},
|
|
2
8
|
"kernel_info": {
|
|
3
9
|
"query": "select * from kernel_info;",
|
|
4
10
|
"name": "os-image",
|
|
5
11
|
"description": "Retrieves information from the current kernel in the target system.",
|
|
6
|
-
"purlType": "swid"
|
|
7
|
-
|
|
8
|
-
"os_version": {
|
|
9
|
-
"query": "select * from os_version;",
|
|
10
|
-
"description": "Retrieves the current version of the running osquery in the target system and where the configuration was loaded from.",
|
|
11
|
-
"purlType": "swid"
|
|
12
|
+
"purlType": "swid",
|
|
13
|
+
"componentType": "operating-system"
|
|
12
14
|
},
|
|
13
15
|
"chrome_extensions": {
|
|
14
16
|
"query": "select chrome_extensions.* from users join chrome_extensions using (uid);",
|
|
15
17
|
"description": "Retrieves the list of extensions for Chrome in the target system.",
|
|
16
|
-
"purlType": "swid"
|
|
18
|
+
"purlType": "swid",
|
|
19
|
+
"componentType": "application"
|
|
17
20
|
},
|
|
18
21
|
"firefox_addons": {
|
|
19
22
|
"query": "select firefox_addons.* from users join firefox_addons using (uid);",
|
|
20
23
|
"description": "Retrieves the list of addons for Firefox in the target system.",
|
|
21
|
-
"purlType": "swid"
|
|
24
|
+
"purlType": "swid",
|
|
25
|
+
"componentType": "application"
|
|
22
26
|
},
|
|
23
27
|
"deb_packages": {
|
|
24
28
|
"query": "select * from deb_packages;",
|
|
@@ -30,6 +34,11 @@
|
|
|
30
34
|
"description": "Retrieves all the APT sources to install packages from in the target Linux system.",
|
|
31
35
|
"purlType": "deb"
|
|
32
36
|
},
|
|
37
|
+
"yum_sources": {
|
|
38
|
+
"query": "select * from yum_sources;",
|
|
39
|
+
"description": "Display yum package manager sources.",
|
|
40
|
+
"purlType": "yum"
|
|
41
|
+
},
|
|
33
42
|
"portage_packages": {
|
|
34
43
|
"query": "select * from portage_packages;",
|
|
35
44
|
"description": "Retrieves all the installed packages on the target Linux system.",
|
|
@@ -40,29 +49,171 @@
|
|
|
40
49
|
"description": "Retrieves all the installed RPM packages in the target Linux system.",
|
|
41
50
|
"purlType": "rpm"
|
|
42
51
|
},
|
|
43
|
-
"
|
|
44
|
-
"query": "select
|
|
45
|
-
"description": "
|
|
52
|
+
"python_packages": {
|
|
53
|
+
"query": "select * from python_packages;",
|
|
54
|
+
"description": "Python packages installed on system.",
|
|
46
55
|
"purlType": "pypi"
|
|
47
56
|
},
|
|
48
57
|
"windows_programs": {
|
|
49
58
|
"query": "select * from programs;",
|
|
50
59
|
"description": "Retrieves the list of products as they are installed by Windows Installer in the target Windows system.",
|
|
51
|
-
"purlType": "swid"
|
|
60
|
+
"purlType": "swid",
|
|
61
|
+
"componentType": "application"
|
|
52
62
|
},
|
|
53
63
|
"windows_patches": {
|
|
54
64
|
"query": "select * from patches;",
|
|
55
65
|
"description": "Retrieves all the information for the current windows drivers in the target Windows system.",
|
|
56
|
-
"purlType": "swid"
|
|
66
|
+
"purlType": "swid",
|
|
67
|
+
"componentType": "application"
|
|
57
68
|
},
|
|
58
69
|
"windows_drivers": {
|
|
59
70
|
"query": "select * from drivers;",
|
|
60
71
|
"description": "Retrieves all the information for the current windows drivers in the target Windows system.",
|
|
61
|
-
"purlType": "swid"
|
|
72
|
+
"purlType": "swid",
|
|
73
|
+
"componentType": "device-driver"
|
|
62
74
|
},
|
|
63
75
|
"windows_shared_resources": {
|
|
64
76
|
"query": "select * from shared_resources;",
|
|
65
77
|
"description": "Retrieves the list of shared resources in the target Windows system.",
|
|
66
|
-
"purlType": "swid"
|
|
78
|
+
"purlType": "swid",
|
|
79
|
+
"componentType": "data"
|
|
80
|
+
},
|
|
81
|
+
"system_info_snapshot": {
|
|
82
|
+
"query": "SELECT * FROM system_info;",
|
|
83
|
+
"description": "System info snapshot query.",
|
|
84
|
+
"purlType": "swid",
|
|
85
|
+
"componentType": "data"
|
|
86
|
+
},
|
|
87
|
+
"pipes_snapshot": {
|
|
88
|
+
"query": "SELECT processes.path, processes.cmdline, processes.uid, processes.on_disk, pipes.name, pid FROM pipes JOIN processes USING (pid);",
|
|
89
|
+
"description": "Pipes snapshot query.",
|
|
90
|
+
"purlType": "swid",
|
|
91
|
+
"componentType": "data"
|
|
92
|
+
},
|
|
93
|
+
"services_snapshot": {
|
|
94
|
+
"query": "SELECT * FROM services;",
|
|
95
|
+
"description": "Services snapshot query.",
|
|
96
|
+
"purlType": "swid",
|
|
97
|
+
"componentType": "data"
|
|
98
|
+
},
|
|
99
|
+
"pipes": {
|
|
100
|
+
"query": "SELECT processes.path, processes.cmdline, processes.uid, processes.on_disk, pipes.name, pid FROM pipes JOIN processes USING (pid);",
|
|
101
|
+
"description": "Named and Anonymous pipes.",
|
|
102
|
+
"purlType": "swid",
|
|
103
|
+
"componentType": "data"
|
|
104
|
+
},
|
|
105
|
+
"etc_hosts": {
|
|
106
|
+
"query": "SELECT * FROM etc_hosts;",
|
|
107
|
+
"description": "List the contents of the Windows hosts file.",
|
|
108
|
+
"purlType": "swid",
|
|
109
|
+
"componentType": "data"
|
|
110
|
+
},
|
|
111
|
+
"scheduled_tasks": {
|
|
112
|
+
"query": "SELECT * FROM scheduled_tasks;",
|
|
113
|
+
"description": "List all scheduled_tasks.",
|
|
114
|
+
"purlType": "swid",
|
|
115
|
+
"componentType": "data"
|
|
116
|
+
},
|
|
117
|
+
"homebrew_packages": {
|
|
118
|
+
"query": "SELECT * FROM homebrew_packages;",
|
|
119
|
+
"description": "List all homebrew_packages.",
|
|
120
|
+
"purlType": "swid",
|
|
121
|
+
"componentType": "data"
|
|
122
|
+
},
|
|
123
|
+
"installed_applications": {
|
|
124
|
+
"query": "SELECT * FROM apps;",
|
|
125
|
+
"description": "List all macos apps.",
|
|
126
|
+
"purlType": "swid",
|
|
127
|
+
"componentType": "data"
|
|
128
|
+
},
|
|
129
|
+
"kernel_integrity": {
|
|
130
|
+
"query": "SELECT * FROM kernel_integrity;",
|
|
131
|
+
"description": "Various Linux kernel integrity checked attributes.",
|
|
132
|
+
"purlType": "swid",
|
|
133
|
+
"componentType": "data"
|
|
134
|
+
},
|
|
135
|
+
"crontab_snapshot": {
|
|
136
|
+
"query": "SELECT * FROM crontab;",
|
|
137
|
+
"description": "Retrieves all the jobs scheduled in crontab in the target system.",
|
|
138
|
+
"purlType": "swid",
|
|
139
|
+
"componentType": "data"
|
|
140
|
+
},
|
|
141
|
+
"kernel_modules": {
|
|
142
|
+
"query": "SELECT * FROM kernel_modules;",
|
|
143
|
+
"description": "Linux kernel modules both loaded and within the load search path.",
|
|
144
|
+
"purlType": "swid",
|
|
145
|
+
"componentType": "data"
|
|
146
|
+
},
|
|
147
|
+
"behavioral_reverse_shell": {
|
|
148
|
+
"query": "SELECT DISTINCT(processes.pid), processes.parent, processes.name, processes.path, processes.cmdline, processes.cwd, processes.root, processes.uid, processes.gid, processes.start_time, process_open_sockets.remote_address, process_open_sockets.remote_port, (SELECT cmdline FROM processes AS parent_cmdline WHERE pid=processes.parent) AS parent_cmdline FROM processes JOIN process_open_sockets USING (pid) LEFT OUTER JOIN process_open_files ON processes.pid = process_open_files.pid WHERE (name='sh' OR name='bash') AND remote_address NOT IN ('0.0.0.0', '::', '') AND remote_address NOT LIKE '10.%' AND remote_address NOT LIKE '192.168.%';",
|
|
149
|
+
"description": "Find shell processes that have open sockets.",
|
|
150
|
+
"purlType": "swid",
|
|
151
|
+
"componentType": "data"
|
|
152
|
+
},
|
|
153
|
+
"process_events": {
|
|
154
|
+
"query": "SELECT auid, cmdline, ctime, cwd, egid, euid, gid, parent, path, pid, time, uid FROM process_events WHERE path NOT IN ('/bin/sed', '/usr/bin/tr', '/bin/gawk', '/bin/date', '/bin/mktemp', '/usr/bin/dirname', '/usr/bin/head', '/usr/bin/jq', '/bin/cut', '/bin/uname', '/bin/basename') and cmdline NOT LIKE '%_key%' AND cmdline NOT LIKE '%secret%';",
|
|
155
|
+
"description": "Process events collected from the audit framework.",
|
|
156
|
+
"purlType": "swid",
|
|
157
|
+
"componentType": "data"
|
|
158
|
+
},
|
|
159
|
+
"ld_preload": {
|
|
160
|
+
"query": "SELECT process_envs.pid, process_envs.key, process_envs.value, processes.name, processes.path, processes.cmdline, processes.cwd FROM process_envs join processes USING (pid) WHERE key = 'LD_PRELOAD';",
|
|
161
|
+
"description": "Any processes that run with an LD_PRELOAD environment variable.",
|
|
162
|
+
"purlType": "swid",
|
|
163
|
+
"componentType": "data"
|
|
164
|
+
},
|
|
165
|
+
"certificates": {
|
|
166
|
+
"query": "SELECT * FROM certificates WHERE path != 'Other People';",
|
|
167
|
+
"description": "List all certificates in the trust store.",
|
|
168
|
+
"purlType": "swid",
|
|
169
|
+
"componentType": "data"
|
|
170
|
+
},
|
|
171
|
+
"processes": {
|
|
172
|
+
"query": "SELECT * FROM processes;",
|
|
173
|
+
"description": "List all processes.",
|
|
174
|
+
"purlType": "swid",
|
|
175
|
+
"componentType": "data"
|
|
176
|
+
},
|
|
177
|
+
"startup_items": {
|
|
178
|
+
"query": "SELECT * FROM startup_items;",
|
|
179
|
+
"description": "List all startup_items.",
|
|
180
|
+
"purlType": "swid",
|
|
181
|
+
"componentType": "data"
|
|
182
|
+
},
|
|
183
|
+
"listening_ports": {
|
|
184
|
+
"query": "SELECT * FROM listening_ports;",
|
|
185
|
+
"description": "List all listening_ports.",
|
|
186
|
+
"purlType": "swid",
|
|
187
|
+
"componentType": "data"
|
|
188
|
+
},
|
|
189
|
+
"interface_addresses": {
|
|
190
|
+
"query": "SELECT * FROM interface_addresses;",
|
|
191
|
+
"description": "List all interface_addresses.",
|
|
192
|
+
"purlType": "swid",
|
|
193
|
+
"componentType": "data"
|
|
194
|
+
},
|
|
195
|
+
"docker_container_ports": {
|
|
196
|
+
"query": "SELECT * FROM docker_container_ports;",
|
|
197
|
+
"description": "List all docker_container_ports.",
|
|
198
|
+
"purlType": "swid",
|
|
199
|
+
"componentType": "data"
|
|
200
|
+
},
|
|
201
|
+
"docker_containers": {
|
|
202
|
+
"query": "SELECT * FROM docker_containers;",
|
|
203
|
+
"description": "List all docker_containers.",
|
|
204
|
+
"purlType": "swid",
|
|
205
|
+
"componentType": "data"
|
|
206
|
+
},
|
|
207
|
+
"docker_networks": {
|
|
208
|
+
"query": "SELECT * FROM docker_networks;",
|
|
209
|
+
"description": "List all docker_networks.",
|
|
210
|
+
"purlType": "swid",
|
|
211
|
+
"componentType": "data"
|
|
212
|
+
},
|
|
213
|
+
"docker_volumes": {
|
|
214
|
+
"query": "SELECT * FROM docker_volumes;",
|
|
215
|
+
"description": "List all docker_volumes.",
|
|
216
|
+
"purlType": "swid",
|
|
217
|
+
"componentType": "data"
|
|
67
218
|
}
|
|
68
219
|
}
|