retrohound 0.0.0-stage → 0.1.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.
Files changed (143) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +9 -0
  3. package/README.md +235 -2
  4. package/dist/THIRD_PARTY_LICENSES +62 -0
  5. package/dist/cli.mjs +364 -0
  6. package/package.json +52 -4
  7. package/rules/LICENSE +28 -0
  8. package/rules/ai_coding_agent/any/control_plane_disable_safety.yml +50 -0
  9. package/rules/ai_coding_agent/any/secrets_credential_store_access.yml +66 -0
  10. package/rules/ai_coding_agent/any/secrets_literal_in_tool_input.yml +37 -0
  11. package/rules/ai_coding_agent/any/secrets_read_secret_file.yml +59 -0
  12. package/rules/ai_coding_agent/config_change/control_plane_bypass_permissions_mode.yml +23 -0
  13. package/rules/ai_coding_agent/correlation/blocked_retry_secret_read.yml +54 -0
  14. package/rules/ai_coding_agent/correlation/exec_mass_delete.yml +36 -0
  15. package/rules/ai_coding_agent/correlation/secrets_read_then_egress.yml +78 -0
  16. package/rules/ai_coding_agent/correlation/secrets_read_then_mcp_payload.yml +49 -0
  17. package/rules/ai_coding_agent/file_event/control_plane_agent_config_risky_write.yml +52 -0
  18. package/rules/ai_coding_agent/file_event/control_plane_agent_config_write.yml +50 -0
  19. package/rules/ai_coding_agent/file_event/control_plane_llm_endpoint_override.yml +102 -0
  20. package/rules/ai_coding_agent/file_event/files_mcp_server_added.yml +19 -0
  21. package/rules/ai_coding_agent/file_event/files_npm_lifecycle_script.yml +20 -0
  22. package/rules/ai_coding_agent/file_event/files_persistence_location.yml +39 -0
  23. package/rules/ai_coding_agent/file_event/files_vscode_task_autorun.yml +19 -0
  24. package/rules/ai_coding_agent/file_event/files_write_outside_project.yml +30 -0
  25. package/rules/ai_coding_agent/instruction_load/files_instruction_concealment.yml +32 -0
  26. package/rules/ai_coding_agent/instruction_load/files_instruction_concealment_skill.yml +34 -0
  27. package/rules/ai_coding_agent/instruction_load/files_invisible_unicode_instruction.yml +37 -0
  28. package/rules/ai_coding_agent/instruction_load/files_invisible_unicode_skill.yml +38 -0
  29. package/rules/ai_coding_agent/instruction_load/files_invisible_unicode_write.yml +39 -0
  30. package/rules/ai_coding_agent/process_creation/control_plane_agent_config_risky_shell_write.yml +51 -0
  31. package/rules/ai_coding_agent/process_creation/control_plane_agent_config_shell_write.yml +49 -0
  32. package/rules/ai_coding_agent/process_creation/control_plane_hook_dropper_script.yml +33 -0
  33. package/rules/ai_coding_agent/process_creation/control_plane_hook_repo_script.yml +56 -0
  34. package/rules/ai_coding_agent/process_creation/exec_chmod_downloaded.yml +20 -0
  35. package/rules/ai_coding_agent/process_creation/exec_cloud_cli_credentials.yml +30 -0
  36. package/rules/ai_coding_agent/process_creation/exec_decode_to_shell.yml +31 -0
  37. package/rules/ai_coding_agent/process_creation/exec_docker_privileged.yml +28 -0
  38. package/rules/ai_coding_agent/process_creation/exec_download_then_run.yml +22 -0
  39. package/rules/ai_coding_agent/process_creation/exec_git_force_push.yml +20 -0
  40. package/rules/ai_coding_agent/process_creation/exec_git_global_hooks.yml +23 -0
  41. package/rules/ai_coding_agent/process_creation/exec_lolbin_download.yml +26 -0
  42. package/rules/ai_coding_agent/process_creation/exec_package_install_new.yml +49 -0
  43. package/rules/ai_coding_agent/process_creation/exec_pipe_download_to_shell.yml +37 -0
  44. package/rules/ai_coding_agent/process_creation/exec_rm_recursive_dangerous.yml +21 -0
  45. package/rules/ai_coding_agent/process_creation/exec_vulnerable_agent_version.yml +22 -0
  46. package/rules/ai_coding_agent/process_creation/files_mcp_server_command.yml +18 -0
  47. package/rules/ai_coding_agent/process_creation/files_persistence_command.yml +36 -0
  48. package/rules/ai_coding_agent/process_creation/network_paste_filedrop_command.yml +109 -0
  49. package/rules/ai_coding_agent/process_creation/secrets_credential_store_probe.yml +30 -0
  50. package/rules/ai_coding_agent/process_creation/secrets_env_dump.yml +48 -0
  51. package/rules/ai_coding_agent/web_request/network_paste_filedrop_domains.yml +84 -0
  52. package/rules/tests/blocked_retry_secret_read/negative.jsonl +61 -0
  53. package/rules/tests/blocked_retry_secret_read/positive.jsonl +4 -0
  54. package/rules/tests/control_plane_agent_config_risky_shell_write/negative.jsonl +2 -0
  55. package/rules/tests/control_plane_agent_config_risky_shell_write/positive.jsonl +2 -0
  56. package/rules/tests/control_plane_agent_config_risky_write/negative.jsonl +2 -0
  57. package/rules/tests/control_plane_agent_config_risky_write/positive.jsonl +5 -0
  58. package/rules/tests/control_plane_agent_config_shell_write/negative.jsonl +4 -0
  59. package/rules/tests/control_plane_agent_config_shell_write/positive.jsonl +3 -0
  60. package/rules/tests/control_plane_agent_config_write/negative.jsonl +3 -0
  61. package/rules/tests/control_plane_agent_config_write/positive.jsonl +5 -0
  62. package/rules/tests/control_plane_bypass_permissions_mode/negative.jsonl +3 -0
  63. package/rules/tests/control_plane_bypass_permissions_mode/positive.jsonl +1 -0
  64. package/rules/tests/control_plane_disable_safety/negative.jsonl +5 -0
  65. package/rules/tests/control_plane_disable_safety/positive.jsonl +6 -0
  66. package/rules/tests/control_plane_hook_dropper_script/negative.jsonl +7 -0
  67. package/rules/tests/control_plane_hook_dropper_script/positive.jsonl +4 -0
  68. package/rules/tests/control_plane_hook_repo_script/negative.jsonl +6 -0
  69. package/rules/tests/control_plane_hook_repo_script/positive.jsonl +5 -0
  70. package/rules/tests/control_plane_llm_endpoint_command/negative.jsonl +12 -0
  71. package/rules/tests/control_plane_llm_endpoint_command/positive.jsonl +18 -0
  72. package/rules/tests/control_plane_llm_endpoint_override/negative.jsonl +7 -0
  73. package/rules/tests/control_plane_llm_endpoint_override/positive.jsonl +14 -0
  74. package/rules/tests/exec_chmod_downloaded/negative.jsonl +3 -0
  75. package/rules/tests/exec_chmod_downloaded/positive.jsonl +3 -0
  76. package/rules/tests/exec_cloud_cli_credentials/negative.jsonl +4 -0
  77. package/rules/tests/exec_cloud_cli_credentials/positive.jsonl +5 -0
  78. package/rules/tests/exec_decode_to_shell/negative.jsonl +6 -0
  79. package/rules/tests/exec_decode_to_shell/positive.jsonl +8 -0
  80. package/rules/tests/exec_docker_privileged/negative.jsonl +3 -0
  81. package/rules/tests/exec_docker_privileged/positive.jsonl +4 -0
  82. package/rules/tests/exec_download_then_run/negative.jsonl +12 -0
  83. package/rules/tests/exec_download_then_run/positive.jsonl +6 -0
  84. package/rules/tests/exec_git_force_push/negative.jsonl +5 -0
  85. package/rules/tests/exec_git_force_push/positive.jsonl +5 -0
  86. package/rules/tests/exec_git_global_hooks/negative.jsonl +3 -0
  87. package/rules/tests/exec_git_global_hooks/positive.jsonl +2 -0
  88. package/rules/tests/exec_lolbin_download/negative.jsonl +3 -0
  89. package/rules/tests/exec_lolbin_download/positive.jsonl +4 -0
  90. package/rules/tests/exec_mass_delete/negative.jsonl +49 -0
  91. package/rules/tests/exec_mass_delete/positive.jsonl +25 -0
  92. package/rules/tests/exec_package_install_new/negative.jsonl +17 -0
  93. package/rules/tests/exec_package_install_new/positive.jsonl +13 -0
  94. package/rules/tests/exec_pipe_download_to_shell/negative.jsonl +15 -0
  95. package/rules/tests/exec_pipe_download_to_shell/positive.jsonl +45 -0
  96. package/rules/tests/exec_rm_recursive_dangerous/negative.jsonl +8 -0
  97. package/rules/tests/exec_rm_recursive_dangerous/positive.jsonl +11 -0
  98. package/rules/tests/exec_vulnerable_agent_version/negative.jsonl +5 -0
  99. package/rules/tests/exec_vulnerable_agent_version/positive.jsonl +2 -0
  100. package/rules/tests/files_instruction_concealment/negative.jsonl +1 -0
  101. package/rules/tests/files_instruction_concealment/positive.jsonl +3 -0
  102. package/rules/tests/files_instruction_concealment_skill/negative.jsonl +3 -0
  103. package/rules/tests/files_instruction_concealment_skill/positive.jsonl +1 -0
  104. package/rules/tests/files_invisible_unicode_instruction/negative.jsonl +2 -0
  105. package/rules/tests/files_invisible_unicode_instruction/positive.jsonl +2 -0
  106. package/rules/tests/files_invisible_unicode_skill/negative.jsonl +3 -0
  107. package/rules/tests/files_invisible_unicode_skill/positive.jsonl +1 -0
  108. package/rules/tests/files_invisible_unicode_write/negative.jsonl +2 -0
  109. package/rules/tests/files_invisible_unicode_write/positive.jsonl +2 -0
  110. package/rules/tests/files_mcp_server_added/negative.jsonl +2 -0
  111. package/rules/tests/files_mcp_server_added/positive.jsonl +2 -0
  112. package/rules/tests/files_mcp_server_command/negative.jsonl +1 -0
  113. package/rules/tests/files_mcp_server_command/positive.jsonl +2 -0
  114. package/rules/tests/files_npm_lifecycle_script/negative.jsonl +3 -0
  115. package/rules/tests/files_npm_lifecycle_script/positive.jsonl +3 -0
  116. package/rules/tests/files_persistence_command/negative.jsonl +3 -0
  117. package/rules/tests/files_persistence_command/positive.jsonl +4 -0
  118. package/rules/tests/files_persistence_location/negative.jsonl +1 -0
  119. package/rules/tests/files_persistence_location/positive.jsonl +4 -0
  120. package/rules/tests/files_vscode_task_autorun/negative.jsonl +3 -0
  121. package/rules/tests/files_vscode_task_autorun/positive.jsonl +1 -0
  122. package/rules/tests/files_write_outside_project/negative.jsonl +9 -0
  123. package/rules/tests/files_write_outside_project/positive.jsonl +3 -0
  124. package/rules/tests/network_paste_filedrop_command/negative.jsonl +2 -0
  125. package/rules/tests/network_paste_filedrop_command/positive.jsonl +3 -0
  126. package/rules/tests/network_paste_filedrop_domains/negative.jsonl +3 -0
  127. package/rules/tests/network_paste_filedrop_domains/positive.jsonl +3 -0
  128. package/rules/tests/secrets_credential_store_access/negative.jsonl +8 -0
  129. package/rules/tests/secrets_credential_store_access/positive.jsonl +8 -0
  130. package/rules/tests/secrets_credential_store_probe/negative.jsonl +4 -0
  131. package/rules/tests/secrets_credential_store_probe/positive.jsonl +3 -0
  132. package/rules/tests/secrets_env_dump/negative.jsonl +23 -0
  133. package/rules/tests/secrets_env_dump/positive.jsonl +26 -0
  134. package/rules/tests/secrets_literal_in_tool_input/negative.jsonl +5 -0
  135. package/rules/tests/secrets_literal_in_tool_input/positive.jsonl +5 -0
  136. package/rules/tests/secrets_read_secret_file/negative.jsonl +5 -0
  137. package/rules/tests/secrets_read_secret_file/positive.jsonl +5 -0
  138. package/rules/tests/secrets_read_secret_file_shell/negative.jsonl +9 -0
  139. package/rules/tests/secrets_read_secret_file_shell/positive.jsonl +6 -0
  140. package/rules/tests/secrets_read_then_egress/negative.jsonl +10 -0
  141. package/rules/tests/secrets_read_then_egress/positive.jsonl +4 -0
  142. package/rules/tests/secrets_read_then_mcp_payload/negative.jsonl +4 -0
  143. package/rules/tests/secrets_read_then_mcp_payload/positive.jsonl +2 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ RetroHound
2
+ Copyright 2026 Raman Kumar
3
+
4
+ This product includes software developed by Raman Kumar (https://github.com/Raman-Lab1/RetroHound).
5
+
6
+ The code is licensed under the Apache License, Version 2.0 (LICENSE). The detection rules under rules/ are
7
+ licensed under the Detection Rule License (DRL) 1.1 (rules/LICENSE).
8
+
9
+ The bundled CLI (dist/cli.mjs) inlines third-party packages; their licences are in dist/THIRD_PARTY_LICENSES.
package/README.md CHANGED
@@ -1,3 +1,236 @@
1
- # Temporary Holding Version
1
+ # RetroHound
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/Raman-Lab1/RetroHound/actions/workflows/ci.yml/badge.svg)](https://github.com/Raman-Lab1/RetroHound/actions/workflows/ci.yml)
4
+ [![Code: Apache-2.0](https://img.shields.io/badge/code-Apache--2.0-blue)](LICENSE)
5
+ [![Rules: DRL 1.1](https://img.shields.io/badge/rules-DRL%201.1-blue)](rules/LICENSE)
6
+ [![Network: zero calls](https://img.shields.io/badge/network-zero%20calls-brightgreen)](#privacy)
7
+
8
+ **What did your AI coding agent actually run?** RetroHound reads the transcripts Claude Code, Codex CLI and
9
+ Antigravity CLI already keep on your machine and checks them with Sigma rules: secrets read, scripts piped into a
10
+ shell, agent config and hooks rewritten, data sent to paste sites, including what sub-agents did and what was blocked
11
+ and then retried. Local, offline, and the evidence outlives the agent's own cleanup.
12
+
13
+ <p align="center">
14
+ <img src="docs/assets/demo.gif" alt="retrohound scan lists findings by severity, retrohound show prints the session timeline, and the hook denies a curl | sh before it runs" width="100%">
15
+ </p>
16
+ <p align="center"><sub>Recorded on a synthetic history (<code>scripts/demo-history.ts</code>, <code>docs/demo/demo.tape</code>), not a real one.</sub></p>
17
+
18
+ ## Quick start
19
+
20
+ With [Bun](https://bun.sh) and Node >= 22.13 (an npm package is coming):
21
+
22
+ ```sh
23
+ git clone https://github.com/Raman-Lab1/RetroHound && cd RetroHound
24
+ bun install && bun run build
25
+ node dist/cli.mjs scan # reads ~/.claude, prints findings; nothing leaves your machine
26
+ ```
27
+
28
+ Then `node dist/cli.mjs show <session-id>` for one session's timeline. Below, `retrohound` means `node dist/cli.mjs`.
29
+
30
+ ## What it catches
31
+
32
+ 46 Sigma rules on an `ai_coding_agent` logsource ([rules/ai_coding_agent](rules/ai_coding_agent)), for example:
33
+
34
+ | Family | Examples |
35
+ |---|---|
36
+ | Secrets | `.env` and SSH keys read, blocked then retried, then sent out; keys pasted into tool input; credential stores probed |
37
+ | Execution | `curl \| sh`, download then run, decode to shell, LOLBin downloads, dangerous `rm -rf`, `git push --force`, privileged Docker |
38
+ | Control plane | agent settings, hooks, MCP servers and LLM endpoints rewritten; safety modes turned off |
39
+ | Persistence | shell profiles, LaunchAgents, startup folders, git global hooks, npm lifecycle scripts, auto-running VS Code tasks |
40
+ | Instructions | invisible Unicode and concealment phrases in CLAUDE.md, AGENTS.md and skills |
41
+ | Exfiltration | uploads to paste and file-drop sites, tunnels and webhooks |
42
+
43
+ ## How it works
44
+
45
+ ```
46
+ ~/.claude, ~/.codex, Antigravity history
47
+ │ parse (secrets masked)
48
+ ▼
49
+ normalized events ──► Sigma rules ──► findings ──► table · JSON · SARIF · ECS / OCSF NDJSON
50
+ │ └──────► masked SQLite index (outlives transcript cleanup)
51
+ └ live, optional: PreToolUse hook ──► enforce-lane rules only ──► log / ask / deny (fails open)
52
+ ```
53
+
54
+ ## What it does
55
+
56
+ Claude Code leaves a transcript of every session in `~/.claude/projects`. RetroHound reads them after the fact, with
57
+ no setup and no hook, and reports:
58
+
59
+ - **What the agent tried.** Tool calls Claude Code blocked, kept apart from the ones you rejected or interrupted, and
60
+ blocked-then-retried sequences (for example four attempts on one `.env`).
61
+ - **Who did it.** Each finding carries the sub-agent id, so you can see what happened outside the main conversation.
62
+ - **Evidence that outlives the cleanup.** Claude Code deletes transcripts after `cleanupPeriodDays` (default 30).
63
+ RetroHound keeps a masked, append-only index; deleted transcripts stay searchable there.
64
+ - **Secrets, as rule #1.** Secret files read, secrets in tool input, with masked values and fingerprints, not raw text.
65
+
66
+ Detections are Sigma v2.1 YAML with a proposed `ai_coding_agent` logsource. 46 rules ship today, plus 6 silent helper rules that only feed correlations (`rules/ai_coding_agent`).
67
+
68
+ ## What it does not do
69
+
70
+ - Not a live guard by default. It reads history. The optional `hook` (v0.2, below) can ask or deny a tool call, but only
71
+ for the few high-precision `enforce` rules, and it fails open.
72
+ - Not a secret scanner that rewrites transcripts. It never modifies or deletes them.
73
+ - No MCP-server scanning, sandboxing, fleet console, cloud, or auto-remediation (spec non-goals).
74
+ - Claude Code, Codex CLI and Antigravity CLI are parsed (`scan --agent claude_code|codex|antigravity`, one per run).
75
+ Gemini CLI and Cursor are not. Codex and Antigravity do not record the CLI's own approvals in their history, so a
76
+ denied command leaves no trace there; Codex's auto-review verdicts are kept and a refusal counts as blocked.
77
+
78
+ ## Install
79
+
80
+ Not yet on npm; see [Quick start](#quick-start). In development, `bun src/cli/bin.ts` runs the same CLI.
81
+
82
+ ```
83
+ retrohound scan # index ~/.claude and print findings
84
+ retrohound scan --since 30d --level high
85
+ retrohound scan --agent codex # ~/.codex (or $CODEX_HOME); also --agent antigravity
86
+ retrohound show 7f3c # timeline of one session (id prefix works)
87
+ retrohound wrapped --anonymize # shareable HTML report card
88
+ ```
89
+
90
+ ## Commands
91
+
92
+ | Command | What it does |
93
+ |---|---|
94
+ | `scan` | Scan an agent's transcripts (Claude Code by default), index them, report findings. |
95
+ | `rules list` / `rules show <rule>` / `rules test [dir]` | Inspect loaded rules (and rejected ones, with the reason); check every rule has passing tests. |
96
+ | `query <sql>` | Read-only SQL over the index. Tables: `events`, `sessions`, `findings`, `files_indexed`. |
97
+ | `show <session-id>` | Timeline of one session with findings highlighted. |
98
+ | `wrapped` | Write a self-contained HTML report card. |
99
+ | `purge` | Delete the index database. |
100
+ | `preflight [dir]` | Before opening a cloned repo with an agent: check its agent surface (`.claude/`, `.mcp.json`, CLAUDE.md/AGENTS.md, skills, `.vscode/tasks.json`, npm lifecycle scripts) with the same rules. Reads files as text; runs nothing. |
101
+ | `hook install` / `hook uninstall` / `hook status` | Optional live guard (v0.2): a `PreToolUse` hook for Claude Code, Codex CLI or Antigravity CLI (`--agent`) that runs only `enforce`-lane rules. `--mode log` (record what it would do), `confirm` (ask you) or `block` (deny). Backs up the file, touches only its own entry, fails open. |
102
+ | `mcp` | Serve the index to MCP clients over stdio, read-only: `scan_summary`, `list_findings`, `show_session`, `query`, `list_rules`. |
103
+
104
+ Flags (from `--help`):
105
+
106
+ - `scan`: `--since <30d|12h|date>`, `--agent <claude_code|codex|antigravity>`, `--project <path-substring>`, `--rules <dir>`,
107
+ `--level <informational|low|medium|high|critical>` (hide lower), `--format <table|json|sarif|ndjson-ecs|ndjson-ocsf>`, `--no-index` (evaluate in
108
+ memory, write nothing), `--fail-on <level>` (exit 1 at or above it, for CI), `--db <path>`,
109
+ `--root <dir>` (Claude config dir or its `projects` dir; default `~/.claude`).
110
+ - `rules list`, `rules show`: `--rules <dir>`. `rules test [dir]`: `--tests <dir>` (default `<dir>/../tests`).
111
+ - `query`: `--format <table|json>`, `--db <path>`.
112
+ - `show`: `--db <path>`, `--rules <dir>`.
113
+ - `wrapped`: `--since <when>` (default `365d`), `--anonymize` (hash project names, user name, project dirs),
114
+ `--out <file.html|file.svg>` (default `wrapped.html`), `--db <path>`, `--rules <dir>`. `--out card.svg` writes a
115
+ self-contained 1200x630 share card (system fonts, no scripts or external references, secrets masked) that any
116
+ browser shows and any tool can convert to PNG.
117
+ - `purge`: `--db <path>`, `--yes`. Without `--yes` it only says what it would delete.
118
+ - `preflight [dir]`: `--rules <dir>`, `--format <table|json>`, `--fail-on <level>`, `--ignore <file>`.
119
+ - `hook install`: `--agent <claude_code|codex|antigravity>`, `--mode <log|confirm|block>`, `--scope <user|project|local>`, `--settings <path>`, `--fail-closed`,
120
+ `--dry-run`, `--allow-unsafe-path`. Start with `--mode log` and read `~/.retrohound/hook-log.jsonl` before blocking
121
+ anything.
122
+ - `mcp`: `--db <path>`, `--rules <dir>`. Register it with `claude mcp add retrohound -- retrohound mcp`.
123
+ - `scan`, `preflight`, `hook run` also take `--ignore <file>` (below).
124
+
125
+ `scan --format json` prints one document, schema `retrohound.scan/0.1`; `sarif` is SARIF 2.1.0 and `ndjson-ecs` /
126
+ `ndjson-ocsf` give one SIEM line per finding: [docs/output-schema.md](docs/output-schema.md).
127
+
128
+ ### Ignoring known-benign findings
129
+
130
+ Put entries in `~/.retrohound/ignore.yml`, or pass a file with `--ignore <file>`:
131
+
132
+ ```yaml
133
+ - rule: control_plane_hook_repo_script # rule id or name
134
+ match: { command_line: "node ./scripts/my-hook.mjs" } # exact values, as shown in the JSON report
135
+ project_path: /home/x/acme # optional
136
+ reason: my own hook # optional
137
+ ```
138
+
139
+ A finding is hidden when its rule matches and every `match` field (and `project_path`) equals the finding's first
140
+ event exactly. Hidden findings are counted ("N findings suppressed" in the table, `scan.suppressed` in JSON) and stay
141
+ in the index. A malformed file stops the run with an error naming the file and entry. A repo's own
142
+ `.retrohound-ignore.yml` is never read implicitly, because a malicious clone could hide its own activity with it: pass
143
+ it with `--ignore` if you trust it.
144
+
145
+ ### Hook on Codex and Antigravity
146
+
147
+ `hook install --agent codex` edits `~/.codex/hooks.json`; `--agent antigravity` edits `~/.gemini/config/hooks.json`
148
+ (`--scope project` uses `.codex/` or `.agents/` in the repo). Both are set up from the vendors' docs and tested on temp
149
+ files only, not yet in a live session:
150
+ - Codex runs a new or changed hook only after you trust it in `/hooks`, and has no "ask", so `confirm` is refused there.
151
+ - Antigravity's docs call the hook's `decision` required; RetroHound prints nothing when it has nothing to say (it
152
+ never prints "allow"). Try `--agent antigravity --scope project --mode log` in a throwaway repo first and check that
153
+ normal tool calls still run before installing it for your user.
154
+
155
+ ### Hook install safety
156
+
157
+ The hook runs on every tool call, so `hook install` refuses (exit 2, nothing written) if the runtime (`node` or `bun`)
158
+ or the RetroHound entry file could be changed by someone else. On macOS and Linux each of them and every parent
159
+ directory up to the first root-owned system directory must be owned by you or root and not group- or world-writable
160
+ (sticky directories such as `/tmp` are exempt); installing from the temp directory or from a world-writable current
161
+ directory is refused. Windows permissions are ACLs, which RetroHound does not read: it only checks that both files
162
+ exist, are not in the temp directory, and sit under your profile or a Program Files directory, so install from a folder
163
+ only you control. For a safe setup that trips the check (for example Homebrew directories owned by an admin group),
164
+ `--allow-unsafe-path` installs anyway with a warning, and `hook status` reports it. `hook status` re-checks the
165
+ installed paths every time and warns if they no longer pass.
166
+
167
+ ## Privacy
168
+
169
+ - **Zero network calls.** No telemetry, no uploads, no update checks. A test (`tests/guards.test.ts`) fails the build
170
+ if any module in `src/` imports a network module or calls `fetch`.
171
+ - **Secrets are masked** in the index, in every output, and in logs. Findings keep pattern names and a short
172
+ fingerprint, never the value.
173
+ - **Raw text is never stored.** Rules see raw text in memory while parsing; the index holds masked fields and a
174
+ pointer (`raw_ref`: file and line) back to the transcript.
175
+ - **The index** is `~/.retrohound/index.db` (override with `--db`), directory 0700, file 0600 on macOS and Linux.
176
+ On Windows those modes protect nothing; rely on your user profile permissions. It is long-lived evidence, so it
177
+ may be the only copy of sessions Claude Code deleted. `retrohound purge --yes` deletes it.
178
+
179
+ ## Retention warning
180
+
181
+ Claude Code deletes transcripts older than `cleanupPeriodDays` (default 30). `scan` prints your window and warns when
182
+ it is 30 or less. To keep transcripts longer, set `"cleanupPeriodDays": 3650` in `~/.claude/settings.json`;
183
+ RetroHound never edits that file. Fix secret findings first: longer retention keeps plaintext secrets longer. The
184
+ index keeps the masked record either way, as long as you scan before the deletion.
185
+
186
+ ## What it found on my machine
187
+
188
+ One developer machine (the author's), mostly sessions working on RetroHound itself, so self-referential. 9 sessions,
189
+ 3,272 events, 41 findings from 8 of the 38 rules shipped at that time (46 ship now). Counts only; see [docs/perf.md](docs/perf.md) for the review.
190
+
191
+ | Rule | Level | Hits | Sessions |
192
+ |---|---|---|---|
193
+ | control_plane_hook_repo_script | medium | 19 | 4 |
194
+ | control_plane_agent_config_write | medium | 7 | 2 |
195
+ | exec_package_install_new | informational | 5 | 1 |
196
+ | files_mcp_server_added | medium | 3 | 2 |
197
+ | secrets_literal_in_tool_input | high | 3 | 1 |
198
+ | control_plane_agent_config_risky_write | high | 2 | 1 |
199
+ | exec_pipe_download_to_shell | high | 1 | 1 |
200
+ | control_plane_llm_endpoint_override | high | 1 | 1 |
201
+
202
+ Four of these are known false-positive patterns being tuned. One machine says little about yours.
203
+
204
+ ## Performance (measured, honest)
205
+
206
+ Windows 10 laptop, Bun 1.4.4, idle, synthetic 1,000 sessions / 101,000 events ([docs/perf.md](docs/perf.md)).
207
+
208
+ - Warm scan: about 310-380 ms (target < 5 s: met).
209
+ - Rule evaluation: about 62k events/s on the synthetic sessions (target 50k: met), but about 19k events/s on real
210
+ transcripts with long heredoc command lines, where regex rules dominate. The target names an M-series Mac, not tested.
211
+ - Cold scan: about 20 s for 101k events (5k events/s), dominated by SQLite inserts. No target was set.
212
+
213
+ ## Contributing
214
+
215
+ New rules, false-positive reports and parsers for more agents are welcome: [CONTRIBUTING.md](CONTRIBUTING.md). Please
216
+ read the [code of conduct](CODE_OF_CONDUCT.md), and report vulnerabilities or rule bypasses privately
217
+ ([SECURITY.md](SECURITY.md)).
218
+
219
+ ## Rules
220
+
221
+ - Write your own: [CONTRIBUTING-RULES.md](CONTRIBUTING-RULES.md), copy [docs/rule-template.yml](docs/rule-template.yml).
222
+ - Fields and categories: [docs/logsource.md](docs/logsource.md).
223
+ - Transcript format notes: [docs/formats/claude-code.md](docs/formats/claude-code.md).
224
+
225
+ ## Roadmap
226
+
227
+ - v0.2: `hook` (log / confirm / block) with a parsed-rule cache and install path checks, SARIF and NDJSON export,
228
+ `preflight`, `mcp`, ignore file, `wrapped` SVG card, Codex CLI and Antigravity CLI collectors. Next: `scan --agent all`,
229
+ Codex file-edit and MCP items once real samples exist, Gemini CLI.
230
+ Dropped: rule #22 (ssh/scp to an unknown host; no threat needs it and it is noisy).
231
+ - Later: SIEM conversion via pySigma, upstream logsource proposal to SigmaHQ.
232
+
233
+ ## Licence
234
+
235
+ Code: [Apache License 2.0](LICENSE). Detection rules: [Detection Rule License 1.1](rules/LICENSE). Both ask you to
236
+ credit the author when you reuse or share them: Copyright 2026 Raman Kumar ([NOTICE](NOTICE)).
@@ -0,0 +1,62 @@
1
+ commander@15.1.0 (MIT)
2
+
3
+ (The MIT License)
4
+
5
+ Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ 'Software'), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ ------------------------------------------------------------------------
27
+
28
+ picocolors@1.1.1 (ISC)
29
+
30
+ ISC License
31
+
32
+ Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
33
+
34
+ Permission to use, copy, modify, and/or distribute this software for any
35
+ purpose with or without fee is hereby granted, provided that the above
36
+ copyright notice and this permission notice appear in all copies.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
39
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
40
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
41
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
42
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
43
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
44
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
45
+
46
+ ------------------------------------------------------------------------
47
+
48
+ yaml@2.9.1 (ISC)
49
+
50
+ Copyright Eemeli Aro <eemeli@gmail.com>
51
+
52
+ Permission to use, copy, modify, and/or distribute this software for any purpose
53
+ with or without fee is hereby granted, provided that the above copyright notice
54
+ and this permission notice appear in all copies.
55
+
56
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
57
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
58
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
59
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
60
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
61
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
62
+ THIS SOFTWARE.