pre-commit-bigfix 2.1.1__tar.gz → 2.2.0__tar.gz
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.
- {pre_commit_bigfix-2.1.1/pre_commit_bigfix.egg-info → pre_commit_bigfix-2.2.0}/PKG-INFO +89 -2
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/README.md +88 -1
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/__init__.py +1 -1
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_common.py +10 -0
- pre_commit_bigfix-2.2.0/pre_commit_bigfix/bes_content_score_risk.py +1376 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_conventions_check.py +31 -1
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/run_all.py +5 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0/pre_commit_bigfix.egg-info}/PKG-INFO +89 -2
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix.egg-info/SOURCES.txt +3 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix.egg-info/entry_points.txt +1 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/setup.cfg +1 -0
- pre_commit_bigfix-2.2.0/tests/test_bes_content_score_risk.py +884 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_conventions_check.py +67 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/LICENSE +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/MANIFEST.in +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_actionscript_lint_schclass.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_actionscript_validate_prefetch.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_actionscript_validate_script.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_relevance_convert_group.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_relevance_lint.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_schema_validate.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/bes_siterepo_validate_layout.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/schclass.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/schclass_data/ExpandedActionScript.schclass +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/schclass_data/bigfix_overrides.schclass +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix/schclass_tokenizer.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix.egg-info/dependency_links.txt +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix.egg-info/requires.txt +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pre_commit_bigfix.egg-info/top_level.txt +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/pyproject.toml +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/setup.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_actionscript_lint_schclass.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_actionscript_validate_prefetch.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_actionscript_validate_script.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_common.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_relevance_convert_group.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_relevance_lint.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_schema_validate.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_bes_siterepo_validate_layout.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_hook_declarations.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_package_metadata.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_release_workflow.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_run_all.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_schclass.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_schclass_tokenizer.py +0 -0
- {pre_commit_bigfix-2.1.1 → pre_commit_bigfix-2.2.0}/tests/test_schema_guard.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pre-commit-bigfix
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: pre-commit hooks for BigFix content
|
|
5
5
|
Home-page: https://github.com/jgstew/pre-commit-bigfix
|
|
6
6
|
Author: JGStew
|
|
@@ -52,6 +52,7 @@ repos:
|
|
|
52
52
|
- id: bes-actionscript-validate-script
|
|
53
53
|
- id: bes-relevance-lint
|
|
54
54
|
- id: bes-relevance-convert-group
|
|
55
|
+
- id: bes-content-score-risk
|
|
55
56
|
# only in a Git External Custom Site (repository site) repo:
|
|
56
57
|
- id: bes-siterepo-validate-layout
|
|
57
58
|
```
|
|
@@ -176,7 +177,8 @@ action-ui-metadata / CPE-2.3 / CVENames / x-relevance-evaluation-period,
|
|
|
176
177
|
prefetch-line shape (URL schemes overridable with `--prefetch-url-schemes`)
|
|
177
178
|
and https URLs, CDATA usage, blank-line and
|
|
178
179
|
trailing-whitespace spacing, empty ActionScript, dynamic download statements,
|
|
179
|
-
a UTF-8 XML declaration,
|
|
180
|
+
a UTF-8 XML declaration, no DTD (`<!DOCTYPE ...>`, `E223`: the BigFix Console
|
|
181
|
+
refuses to import a file that has one), Title placeholders / whitespace / TODO markers,
|
|
180
182
|
non-trivial non-empty Relevance with no stray whitespace, unique MIMEField
|
|
181
183
|
names, unique Analysis Property names/IDs, unique Action IDs, action link text
|
|
182
184
|
free of empty-substitution gaps, SuccessCriteria body/Option consistency, a
|
|
@@ -701,6 +703,91 @@ rewrite shows up for review; `--check` only reports. With no files given it
|
|
|
701
703
|
checks every `*.bes` below the current folder and never rewrites. A file opts
|
|
702
704
|
out with `<!-- pre-commit-skip: bes-relevance-convert-group -->`.
|
|
703
705
|
|
|
706
|
+
### bes-content-score-risk
|
|
707
|
+
|
|
708
|
+
Scores how risky a BES file's content is and lists the reasons, so content
|
|
709
|
+
that needs a careful human review is flagged before it is trusted. It is a
|
|
710
|
+
triage signal, not a verdict, and it never changes a file. Each finding adds
|
|
711
|
+
points; a file at or over `--fail-score` (default 50, the HIGH band) fails
|
|
712
|
+
with `E900`.
|
|
713
|
+
|
|
714
|
+
| code | points | signal |
|
|
715
|
+
| --- | --- | --- |
|
|
716
|
+
| `W901` | 20 | script in a Description: `<script>`, `javascript:`, an `on*=` handler |
|
|
717
|
+
| `W902` | 25 | session relevance in a Description: `<?relevance ...?>`, `EvaluateRelevance(` |
|
|
718
|
+
| `W903` | 15 | both in one Description |
|
|
719
|
+
| `W910` | 25 | ActionScript `download` / `download now`: not hashed. A later `continue if {sha1 of ...}` does not excuse it; use a prefetch |
|
|
720
|
+
| `W911` | 25 | `add nohash prefetch item` |
|
|
721
|
+
| `W912` | 10 | a download or prefetch URL over plain `http://` or to a raw IP |
|
|
722
|
+
| `W913` | 15 | a download command in script content (`curl`, `wget`, `Invoke-WebRequest`, `DownloadString`, `bitsadmin`, ...) |
|
|
723
|
+
| `W920` | 2 | base64 that really is an image of its `data:image/` type |
|
|
724
|
+
| `W921` | 20 | base64 (80+ characters) anywhere else |
|
|
725
|
+
| `W922` | 25 | a decoded payload is an executable or a script |
|
|
726
|
+
| `W923` | 20 | a decode or dynamic-run command: `certutil -decode`, `base64 -d`, `FromBase64String`, `powershell -EncodedCommand`, `Invoke-Expression` / `iex`, PsExec, `curl ... \| sh` |
|
|
727
|
+
| `W924` | 15 | other obfuscation: `\x`, `\u`, `%XX` or hex runs decoding to ASCII; `eval(`, `unescape(`, `atob(`, `Function(`, `fromCharCode(` |
|
|
728
|
+
| `W925` | 15 | a decoded payload is gzip, zlib or zip compressed |
|
|
729
|
+
| `W926` | 30 | base64 labelled `data:image/` whose bytes are not that image |
|
|
730
|
+
| `W927` | 10 + inner | a decoded payload holds findings of its own; names the decode path (`base64->gzip->text`) |
|
|
731
|
+
| `W928` | 15 | decoding stopped: 4 MB were decoded, so later payloads were only checked for an executable header |
|
|
732
|
+
| `W929` | 20 | a DTD in the prolog, once per file: its entities are not expanded, and the BigFix Console refuses the file (`bes-conventions-check` `E223`). A DOCTYPE an action writes out, such as a plist's, does not count |
|
|
733
|
+
| `W930` | 25 | a hardcoded secret: `password=`, `token=`, `api_key:` and the like with a literal value (not a `{parameter}`, `$var` or `%VAR%`), a private key, an AWS access key ID. The value is never printed |
|
|
734
|
+
| `W931` | 20 | a command that weakens security: disables UAC, Defender, a firewall, SELinux, Gatekeeper or SIP; deletes shadow copies or clears event logs; adds a user or an administrator; edits `sudoers` or `authorized_keys` |
|
|
735
|
+
| `W932` | 30 | a Description that loads remote content or reaches outside the page: `<script src>` / `<iframe src>` to a URL, `ActiveXObject`, `WScript.Shell`, `XMLHttpRequest`, `fetch(`, `document.cookie` |
|
|
736
|
+
| `W940` | 30 | tampers with the BigFix client: stops, disables or uninstalls BESClient, deletes `__BESData`, replaces `masthead`/`ActionSite.afxm` |
|
|
737
|
+
| `W941` | 25 | redirects the client to another relay or server (`__RelayServer1/2`, `_BESClient_RelaySelect_*`, ParentRelay, affiliation) |
|
|
738
|
+
| `W942` | 10 | uploads endpoint files to the root server (`archive now`, `_BESClient_ArchiveManager_*`, `_BESClient_UploadManager_*`); the destination cannot be redirected, but the files become readable on the server |
|
|
739
|
+
| `W943` | 25 | calls the BigFix REST API (`/api/actions`, ...): content that can create more content or actions |
|
|
740
|
+
| `W944` | 30 | an action that targets all computers (`<AllComputers>true`) |
|
|
741
|
+
| `W945` | 20 | runs a command taken from a client setting or a file (`wait {value of setting ...}`) |
|
|
742
|
+
| `W946` | 30 | compares `now` to a fixed date in relevance or an action (a time bomb?) |
|
|
743
|
+
| `W947` | 15 | relevance or an action pinned to one host name, IP or MAC |
|
|
744
|
+
| `W948` | 5 | a `{parameter}` placed straight into a command line (command injection?) |
|
|
745
|
+
| `W949` | 20 | uploads files (W942) and reads a credential store (W950) in one file: secrets may end up on the server |
|
|
746
|
+
| `W950` | 30 | reads a credential store: `/etc/shadow`, the SAM or SECURITY hive, SSH keys, browser logins, keychains, `.aws/credentials`, `NTDS.dit`, lsass; in ActionScript, Relevance or an Analysis Property |
|
|
747
|
+
| `W951` | 30 | dumps credentials or prompts for a password: mimikatz, procdump of lsass, `reg save HKLM\SAM`, `Get-Credential`, an AppleScript `with hidden answer` dialog |
|
|
748
|
+
| `W952` | 25 | weakens credential protection: WDigest `UseLogonCredential=1`, `RunAsPPL=0`, `NoLMHash=0` |
|
|
749
|
+
| `W953` | 25 | sends data off the endpoint: `curl -d/-F/-T`, an `Invoke-WebRequest`/`Invoke-RestMethod` POST or PUT, `scp`, `sftp`, `ftp`, `UploadFile` |
|
|
750
|
+
| `W954` | 20 | a URL on a paste site, URL shortener, tunnel (ngrok, trycloudflare), raw.githubusercontent/gist, the Discord CDN, or dynamic DNS |
|
|
751
|
+
| `W955` | 25 | a URL with credentials in it (`https://user:pass@...`) |
|
|
752
|
+
| `W956` | 25 | turns off TLS or host-key verification: `curl -k`, `--no-check-certificate`, `ServerCertificateValidationCallback`, `StrictHostKeyChecking no` |
|
|
753
|
+
| `W957` | 30 | adds a trusted root CA (`certutil -addstore root`, `add-trusted-cert`, `update-ca-certificates`) |
|
|
754
|
+
| `W958` | 20 | changes hosts, DNS or proxy settings |
|
|
755
|
+
| `W959` | 20 | enables remote access: RDP, WinRM, SSH root or password login, SMBv1, the guest account, `LocalAccountTokenFilterPolicy=1` |
|
|
756
|
+
| `W960` | 30 | bypasses AMSI or ETW, loads code reflectively, or compiles it at run time (`Add-Type -TypeDefinition`, `csc.exe`, an MSBuild project, `VirtualAlloc`) |
|
|
757
|
+
| `W961` | 20 | a built-in binary used to run code: `mshta`, `regsvr32 /i:`, `rundll32 javascript:`, `wmic process call create`, `odbcconf`, `forfiles /c`, `cmstp` |
|
|
758
|
+
| `W962` | 20 | keyword obfuscation: PowerShell backticks or cmd carets inside a word, env-var substrings other than `%DATE%`/`%TIME%`, split-and-joined strings, `-bxor`, string reversal |
|
|
759
|
+
| `W963` | 30 | a bidi or zero-width character, which can hide code (a byte-order mark opening the file is fine) |
|
|
760
|
+
| `W964` | 20 | stops or removes a security tool: Defender, an EDR agent, Sysmon, Tanium, osquery, auditd |
|
|
761
|
+
| `W965` | 15 | hides or backdates files (`attrib +h +s`, `touch -t`, `SetFileTime`) |
|
|
762
|
+
| `W966` | 25 | loads a kernel driver or module (`insmod`, `kextload`), or turns on test signing |
|
|
763
|
+
| `W967` | 15 | setuid or world-writable permissions, `Everyone:F` |
|
|
764
|
+
| `W968` | 20 | an offensive, recon or mining tool: nmap, responder, BloodHound, impacket, xmrig, `stratum+tcp` |
|
|
765
|
+
| `W970` | 25 | stealthy persistence: IFEO `Debugger`, sticky-keys replacement, WMI event subscriptions, Winlogon `Userinit`/`Shell`, `AppInit_DLLs`, `LD_PRELOAD`, `DYLD_INSERT_LIBRARIES`, shell rc and `profile.d` files |
|
|
766
|
+
| `W971` | 10 | ordinary persistence: a Run key, service, launchd or systemd unit, scheduled task or cron job |
|
|
767
|
+
| `W972` | 30 | a destructive disk operation: `diskpart`, `format`, `dd of=/dev/...`, `mkfs`, `shred`, `cipher /w`, `rm -rf /` |
|
|
768
|
+
| `W973` | 20 | SQL that changes data (`DROP`, `DELETE`, `UPDATE`, `TRUNCATE`, `ALTER`), or `xp_cmdshell` |
|
|
769
|
+
| `W980` | 20 | a password field in a Description: credentials collected in the console |
|
|
770
|
+
| `W981` | 30 | a UNC (`\\server\share`) or `file:` link or image in a Description; rendering it may send the operator's NTLM hash |
|
|
771
|
+
| `W982` | 15 | a remote image or media file in a Description: a beacon on whoever opens it |
|
|
772
|
+
| `W983` | 25 | a `<meta refresh>`, `<base href>`, or a `<form action>` posting to another site, in a Description |
|
|
773
|
+
| `W984` | 10 | a hidden element (`display:none`, `visibility:hidden`) in a Description |
|
|
774
|
+
| `W990` | 10 | a `createfile` payload longer than 200 lines: hard to review |
|
|
775
|
+
| `W991` | 15 | a Task or Fixlet titled like a check (Check, Get, Report, Inventory, ...) whose action changes state |
|
|
776
|
+
| `W900` | | a MEDIUM score (25-49) |
|
|
777
|
+
| `W908` | | not parseable XML; skipped |
|
|
778
|
+
| `E900` | | the score is at or over `--fail-score` |
|
|
779
|
+
|
|
780
|
+
Every encoded blob is decoded and scanned again: base64 as UTF-8 and as
|
|
781
|
+
UTF-16LE (PowerShell `-EncodedCommand`), compressed data decompressed, up to
|
|
782
|
+
3 layers and 4 MB per file. `--weight CODE=N` changes a signal's points,
|
|
783
|
+
`--disable CODES` skips signals, and `--fail-score N` moves the threshold.
|
|
784
|
+
The default weights are a starting point, to be tuned against real content.
|
|
785
|
+
|
|
786
|
+
The signals favor recall over precision: it is better to flag something a
|
|
787
|
+
reviewer then accepts than to miss something malicious. Content written by
|
|
788
|
+
`createfile` is scanned like any other script content, so a configuration
|
|
789
|
+
file that only lists tool names (a Sysmon config, say) can still score.
|
|
790
|
+
|
|
704
791
|
### bes-siterepo-validate-layout
|
|
705
792
|
|
|
706
793
|
For a BigFix [Git External Custom Site](https://help.hcl-software.com/bigfix/11.0/platform/Platform/Config/c_repository_site_git.html)
|
|
@@ -20,6 +20,7 @@ repos:
|
|
|
20
20
|
- id: bes-actionscript-validate-script
|
|
21
21
|
- id: bes-relevance-lint
|
|
22
22
|
- id: bes-relevance-convert-group
|
|
23
|
+
- id: bes-content-score-risk
|
|
23
24
|
# only in a Git External Custom Site (repository site) repo:
|
|
24
25
|
- id: bes-siterepo-validate-layout
|
|
25
26
|
```
|
|
@@ -144,7 +145,8 @@ action-ui-metadata / CPE-2.3 / CVENames / x-relevance-evaluation-period,
|
|
|
144
145
|
prefetch-line shape (URL schemes overridable with `--prefetch-url-schemes`)
|
|
145
146
|
and https URLs, CDATA usage, blank-line and
|
|
146
147
|
trailing-whitespace spacing, empty ActionScript, dynamic download statements,
|
|
147
|
-
a UTF-8 XML declaration,
|
|
148
|
+
a UTF-8 XML declaration, no DTD (`<!DOCTYPE ...>`, `E223`: the BigFix Console
|
|
149
|
+
refuses to import a file that has one), Title placeholders / whitespace / TODO markers,
|
|
148
150
|
non-trivial non-empty Relevance with no stray whitespace, unique MIMEField
|
|
149
151
|
names, unique Analysis Property names/IDs, unique Action IDs, action link text
|
|
150
152
|
free of empty-substitution gaps, SuccessCriteria body/Option consistency, a
|
|
@@ -669,6 +671,91 @@ rewrite shows up for review; `--check` only reports. With no files given it
|
|
|
669
671
|
checks every `*.bes` below the current folder and never rewrites. A file opts
|
|
670
672
|
out with `<!-- pre-commit-skip: bes-relevance-convert-group -->`.
|
|
671
673
|
|
|
674
|
+
### bes-content-score-risk
|
|
675
|
+
|
|
676
|
+
Scores how risky a BES file's content is and lists the reasons, so content
|
|
677
|
+
that needs a careful human review is flagged before it is trusted. It is a
|
|
678
|
+
triage signal, not a verdict, and it never changes a file. Each finding adds
|
|
679
|
+
points; a file at or over `--fail-score` (default 50, the HIGH band) fails
|
|
680
|
+
with `E900`.
|
|
681
|
+
|
|
682
|
+
| code | points | signal |
|
|
683
|
+
| --- | --- | --- |
|
|
684
|
+
| `W901` | 20 | script in a Description: `<script>`, `javascript:`, an `on*=` handler |
|
|
685
|
+
| `W902` | 25 | session relevance in a Description: `<?relevance ...?>`, `EvaluateRelevance(` |
|
|
686
|
+
| `W903` | 15 | both in one Description |
|
|
687
|
+
| `W910` | 25 | ActionScript `download` / `download now`: not hashed. A later `continue if {sha1 of ...}` does not excuse it; use a prefetch |
|
|
688
|
+
| `W911` | 25 | `add nohash prefetch item` |
|
|
689
|
+
| `W912` | 10 | a download or prefetch URL over plain `http://` or to a raw IP |
|
|
690
|
+
| `W913` | 15 | a download command in script content (`curl`, `wget`, `Invoke-WebRequest`, `DownloadString`, `bitsadmin`, ...) |
|
|
691
|
+
| `W920` | 2 | base64 that really is an image of its `data:image/` type |
|
|
692
|
+
| `W921` | 20 | base64 (80+ characters) anywhere else |
|
|
693
|
+
| `W922` | 25 | a decoded payload is an executable or a script |
|
|
694
|
+
| `W923` | 20 | a decode or dynamic-run command: `certutil -decode`, `base64 -d`, `FromBase64String`, `powershell -EncodedCommand`, `Invoke-Expression` / `iex`, PsExec, `curl ... \| sh` |
|
|
695
|
+
| `W924` | 15 | other obfuscation: `\x`, `\u`, `%XX` or hex runs decoding to ASCII; `eval(`, `unescape(`, `atob(`, `Function(`, `fromCharCode(` |
|
|
696
|
+
| `W925` | 15 | a decoded payload is gzip, zlib or zip compressed |
|
|
697
|
+
| `W926` | 30 | base64 labelled `data:image/` whose bytes are not that image |
|
|
698
|
+
| `W927` | 10 + inner | a decoded payload holds findings of its own; names the decode path (`base64->gzip->text`) |
|
|
699
|
+
| `W928` | 15 | decoding stopped: 4 MB were decoded, so later payloads were only checked for an executable header |
|
|
700
|
+
| `W929` | 20 | a DTD in the prolog, once per file: its entities are not expanded, and the BigFix Console refuses the file (`bes-conventions-check` `E223`). A DOCTYPE an action writes out, such as a plist's, does not count |
|
|
701
|
+
| `W930` | 25 | a hardcoded secret: `password=`, `token=`, `api_key:` and the like with a literal value (not a `{parameter}`, `$var` or `%VAR%`), a private key, an AWS access key ID. The value is never printed |
|
|
702
|
+
| `W931` | 20 | a command that weakens security: disables UAC, Defender, a firewall, SELinux, Gatekeeper or SIP; deletes shadow copies or clears event logs; adds a user or an administrator; edits `sudoers` or `authorized_keys` |
|
|
703
|
+
| `W932` | 30 | a Description that loads remote content or reaches outside the page: `<script src>` / `<iframe src>` to a URL, `ActiveXObject`, `WScript.Shell`, `XMLHttpRequest`, `fetch(`, `document.cookie` |
|
|
704
|
+
| `W940` | 30 | tampers with the BigFix client: stops, disables or uninstalls BESClient, deletes `__BESData`, replaces `masthead`/`ActionSite.afxm` |
|
|
705
|
+
| `W941` | 25 | redirects the client to another relay or server (`__RelayServer1/2`, `_BESClient_RelaySelect_*`, ParentRelay, affiliation) |
|
|
706
|
+
| `W942` | 10 | uploads endpoint files to the root server (`archive now`, `_BESClient_ArchiveManager_*`, `_BESClient_UploadManager_*`); the destination cannot be redirected, but the files become readable on the server |
|
|
707
|
+
| `W943` | 25 | calls the BigFix REST API (`/api/actions`, ...): content that can create more content or actions |
|
|
708
|
+
| `W944` | 30 | an action that targets all computers (`<AllComputers>true`) |
|
|
709
|
+
| `W945` | 20 | runs a command taken from a client setting or a file (`wait {value of setting ...}`) |
|
|
710
|
+
| `W946` | 30 | compares `now` to a fixed date in relevance or an action (a time bomb?) |
|
|
711
|
+
| `W947` | 15 | relevance or an action pinned to one host name, IP or MAC |
|
|
712
|
+
| `W948` | 5 | a `{parameter}` placed straight into a command line (command injection?) |
|
|
713
|
+
| `W949` | 20 | uploads files (W942) and reads a credential store (W950) in one file: secrets may end up on the server |
|
|
714
|
+
| `W950` | 30 | reads a credential store: `/etc/shadow`, the SAM or SECURITY hive, SSH keys, browser logins, keychains, `.aws/credentials`, `NTDS.dit`, lsass; in ActionScript, Relevance or an Analysis Property |
|
|
715
|
+
| `W951` | 30 | dumps credentials or prompts for a password: mimikatz, procdump of lsass, `reg save HKLM\SAM`, `Get-Credential`, an AppleScript `with hidden answer` dialog |
|
|
716
|
+
| `W952` | 25 | weakens credential protection: WDigest `UseLogonCredential=1`, `RunAsPPL=0`, `NoLMHash=0` |
|
|
717
|
+
| `W953` | 25 | sends data off the endpoint: `curl -d/-F/-T`, an `Invoke-WebRequest`/`Invoke-RestMethod` POST or PUT, `scp`, `sftp`, `ftp`, `UploadFile` |
|
|
718
|
+
| `W954` | 20 | a URL on a paste site, URL shortener, tunnel (ngrok, trycloudflare), raw.githubusercontent/gist, the Discord CDN, or dynamic DNS |
|
|
719
|
+
| `W955` | 25 | a URL with credentials in it (`https://user:pass@...`) |
|
|
720
|
+
| `W956` | 25 | turns off TLS or host-key verification: `curl -k`, `--no-check-certificate`, `ServerCertificateValidationCallback`, `StrictHostKeyChecking no` |
|
|
721
|
+
| `W957` | 30 | adds a trusted root CA (`certutil -addstore root`, `add-trusted-cert`, `update-ca-certificates`) |
|
|
722
|
+
| `W958` | 20 | changes hosts, DNS or proxy settings |
|
|
723
|
+
| `W959` | 20 | enables remote access: RDP, WinRM, SSH root or password login, SMBv1, the guest account, `LocalAccountTokenFilterPolicy=1` |
|
|
724
|
+
| `W960` | 30 | bypasses AMSI or ETW, loads code reflectively, or compiles it at run time (`Add-Type -TypeDefinition`, `csc.exe`, an MSBuild project, `VirtualAlloc`) |
|
|
725
|
+
| `W961` | 20 | a built-in binary used to run code: `mshta`, `regsvr32 /i:`, `rundll32 javascript:`, `wmic process call create`, `odbcconf`, `forfiles /c`, `cmstp` |
|
|
726
|
+
| `W962` | 20 | keyword obfuscation: PowerShell backticks or cmd carets inside a word, env-var substrings other than `%DATE%`/`%TIME%`, split-and-joined strings, `-bxor`, string reversal |
|
|
727
|
+
| `W963` | 30 | a bidi or zero-width character, which can hide code (a byte-order mark opening the file is fine) |
|
|
728
|
+
| `W964` | 20 | stops or removes a security tool: Defender, an EDR agent, Sysmon, Tanium, osquery, auditd |
|
|
729
|
+
| `W965` | 15 | hides or backdates files (`attrib +h +s`, `touch -t`, `SetFileTime`) |
|
|
730
|
+
| `W966` | 25 | loads a kernel driver or module (`insmod`, `kextload`), or turns on test signing |
|
|
731
|
+
| `W967` | 15 | setuid or world-writable permissions, `Everyone:F` |
|
|
732
|
+
| `W968` | 20 | an offensive, recon or mining tool: nmap, responder, BloodHound, impacket, xmrig, `stratum+tcp` |
|
|
733
|
+
| `W970` | 25 | stealthy persistence: IFEO `Debugger`, sticky-keys replacement, WMI event subscriptions, Winlogon `Userinit`/`Shell`, `AppInit_DLLs`, `LD_PRELOAD`, `DYLD_INSERT_LIBRARIES`, shell rc and `profile.d` files |
|
|
734
|
+
| `W971` | 10 | ordinary persistence: a Run key, service, launchd or systemd unit, scheduled task or cron job |
|
|
735
|
+
| `W972` | 30 | a destructive disk operation: `diskpart`, `format`, `dd of=/dev/...`, `mkfs`, `shred`, `cipher /w`, `rm -rf /` |
|
|
736
|
+
| `W973` | 20 | SQL that changes data (`DROP`, `DELETE`, `UPDATE`, `TRUNCATE`, `ALTER`), or `xp_cmdshell` |
|
|
737
|
+
| `W980` | 20 | a password field in a Description: credentials collected in the console |
|
|
738
|
+
| `W981` | 30 | a UNC (`\\server\share`) or `file:` link or image in a Description; rendering it may send the operator's NTLM hash |
|
|
739
|
+
| `W982` | 15 | a remote image or media file in a Description: a beacon on whoever opens it |
|
|
740
|
+
| `W983` | 25 | a `<meta refresh>`, `<base href>`, or a `<form action>` posting to another site, in a Description |
|
|
741
|
+
| `W984` | 10 | a hidden element (`display:none`, `visibility:hidden`) in a Description |
|
|
742
|
+
| `W990` | 10 | a `createfile` payload longer than 200 lines: hard to review |
|
|
743
|
+
| `W991` | 15 | a Task or Fixlet titled like a check (Check, Get, Report, Inventory, ...) whose action changes state |
|
|
744
|
+
| `W900` | | a MEDIUM score (25-49) |
|
|
745
|
+
| `W908` | | not parseable XML; skipped |
|
|
746
|
+
| `E900` | | the score is at or over `--fail-score` |
|
|
747
|
+
|
|
748
|
+
Every encoded blob is decoded and scanned again: base64 as UTF-8 and as
|
|
749
|
+
UTF-16LE (PowerShell `-EncodedCommand`), compressed data decompressed, up to
|
|
750
|
+
3 layers and 4 MB per file. `--weight CODE=N` changes a signal's points,
|
|
751
|
+
`--disable CODES` skips signals, and `--fail-score N` moves the threshold.
|
|
752
|
+
The default weights are a starting point, to be tuned against real content.
|
|
753
|
+
|
|
754
|
+
The signals favor recall over precision: it is better to flag something a
|
|
755
|
+
reviewer then accepts than to miss something malicious. Content written by
|
|
756
|
+
`createfile` is scanned like any other script content, so a configuration
|
|
757
|
+
file that only lists tool names (a Sysmon config, say) can still score.
|
|
758
|
+
|
|
672
759
|
### bes-siterepo-validate-layout
|
|
673
760
|
|
|
674
761
|
For a BigFix [Git External Custom Site](https://help.hcl-software.com/bigfix/11.0/platform/Platform/Config/c_repository_site_git.html)
|
|
@@ -28,6 +28,16 @@ MUSTACHE_RE = re.compile(
|
|
|
28
28
|
r"\s*[#/^!&>]?\s*[\w.-]+\s*\}\}"
|
|
29
29
|
)
|
|
30
30
|
|
|
31
|
+
# a DTD, which can only come in the prolog: before it there may be only a BOM,
|
|
32
|
+
# whitespace, the XML declaration, comments and processing instructions. Each
|
|
33
|
+
# comment or PI stops at its own first `-->` / `?>` and whitespace is one
|
|
34
|
+
# character at a time, so the pattern cannot stretch past the prolog (to a
|
|
35
|
+
# plist's `<?xml ...?><!DOCTYPE plist>` inside an action) or backtrack across
|
|
36
|
+
# a file full of comments.
|
|
37
|
+
PROLOG_DOCTYPE_RE = re.compile(
|
|
38
|
+
"^\ufeff?(?:\\s|<\\?(?:[^?]|\\?(?!>))*\\?>|<!--(?:[^-]|-(?!->))*-->)*(<!DOCTYPE)\\b"
|
|
39
|
+
)
|
|
40
|
+
|
|
31
41
|
# directories never searched by discover_bes_files (hidden ones are skipped too)
|
|
32
42
|
DISCOVERY_SKIP_DIRS = frozenset({"__pycache__", "node_modules"})
|
|
33
43
|
|