64 Commits
Author SHA1 Message Date
栀染 0d6ae413de Merge pull request #7 from koriyoshi2041/feat/llm-generated-payloads
feat: LLM-generated content for honeypot & skill payloads
2026-03-10 01:21:34 +08:00
kigland 45cf3df4ed fix: preserve multi-word topics in CLI generate command
split(maxsplit=2) was splitting "honeypot Kubernetes Security" into
three parts, losing the full topic string. Now splits once to get the
method keyword, then handles remainder per subcommand — honeypot takes
the entire remainder as topic, skill splits it into name + category.
2026-03-10 01:18:27 +08:00
kigland 077371e643 feat: wire LLM generation into CLI generate command
Updated CLI to support:
  generate honeypot [topic]           - LLM mode with custom topic
  generate skill [name] [category]    - LLM mode with skill category

Falls back to template mode when OPENAI_API_KEY is not set.
2026-03-10 01:12:07 +08:00
kigland 5f2d087c0e feat: add LLM-generated content mode for poisoned skill files
When api_key is provided, uses GPT-4 to generate realistic skill
definitions with proper structure, responsibilities, workflow, and
constraints. The trigger is embedded under a randomized section label
(Runtime Configuration / Environment Bootstrap / Session Initialization
/ Workspace Calibration) instead of the conspicuous <diagnostic> tag.

Added 2 new camouflage profiles (devops, database) to the existing 4.
Falls back to hardcoded templates when no api_key is given.
2026-03-10 01:11:31 +08:00
kigland aa82f08e55 feat: add LLM-generated content mode for honeypot pages
When topic and api_key are provided, uses GPT-4 to generate a
realistic, SEO-optimized technical article with proper structure,
meta tags, and Schema.org markup. Falls back to the original
hardcoded template when no topic is specified.

Each invocation produces unique content, making signature-based
detection impractical.
2026-03-10 01:10:41 +08:00
栀染 5974c17e79 Add Star History section to README
Added Star History section with chart link.
2026-03-09 23:52:06 +08:00
栀染 c32afe2eb0 Merge pull request #5 from koriyoshi2041/fix/readme-accuracy
fix: correct several inaccuracies in README and add missing dependency
2026-03-09 20:55:31 +08:00
栀染 ae24b33a74 Merge branch 'main' into fix/readme-accuracy 2026-03-09 20:52:12 +08:00
栀染 27267b6038 Merge pull request #6 from Fldicoahkiin/main
Add missing core.bot_db module and preserve backward compatibility
2026-03-09 20:51:25 +08:00
Flacier a8fb79de21 docs: narrow README updates to bot_db module layout
- revert the broader virtualenv command changes from the previous README update

- keep the README changes focused on the core.bot_db and bot_db.py module layout
2026-03-09 18:11:56 +08:00
Flacier 54621f2e88 fix: add missing core.bot_db module and update setup docs
- add the missing `core.bot_db` module referenced by existing imports

- keep the top-level `bot_db` module as a backward-compatible re-export

- update README to reflect the module layout and venv-based setup flow
2026-03-09 14:15:12 +08:00
kigland 6f779c96b2 fix: clarify trigger_len default discrepancy between constructor and config
Constructor default is 10, config.yaml recommends 15. Added explicit note
so users know to pass the parameter when using the programmatic API.
2026-03-09 13:00:21 +08:00
kigland 35edfae1c7 fix: add missing loguru dependency
core/logger.py imports loguru but it was not listed in requirements.txt,
causing ModuleNotFoundError on fresh installs. Also added to the README
dependency list.
2026-03-09 12:59:57 +08:00
kigland 9a4a3fbc50 fix: clarify OpenClaw as the primary target framework
Previously listed OpenClaw alongside LangChain and AutoGPT as generic
examples, which was confusing given the project is named OpenClaw-PwnKit.
Now explicitly states OpenClaw is the reference target.
2026-03-09 12:59:19 +08:00
kigland 00ad0819da fix: clarify dual-path fitness evaluation in method overview
The fitness function has two scoring paths: tool-call responses use
keyword/substring matching, while text-content responses additionally
use NLL loss from logprobs. The previous description conflated these
into a single scoring mechanism.
2026-03-09 12:58:55 +08:00
kigland ef9d2bcf81 fix: correct GPU memory and disk space estimates
Phi-2 fp16 weights are ~5.2 GB but PyTorch CUDA overhead adds ~2 GB,
so ~8 GB GPU memory is a more realistic recommendation. HuggingFace
caches the fp32 checkpoint (~10 GB) even though the code loads fp16.
2026-03-09 12:58:31 +08:00
kigland 3574004c9a fix: update architecture tree with missing files
Add attacks/docs/SOUL_PROMPT.py, meta/ directory, and LICENSE
to the project structure diagram.
2026-03-09 12:58:05 +08:00
栀染 b14dc5996b Update README.md 2026-03-09 12:27:30 +08:00
栀染 d56c0f1c13 Add files via upload 2026-03-09 12:26:27 +08:00
栀染 770e457f6e Create .gitkeep 2026-03-09 12:25:21 +08:00
栀染 7a48ba51d7 Enhance SEO for honeypot HTML generation
Updated the HTML structure and content for SEO optimization, including meta tags and improved layout.
2026-03-09 12:18:42 +08:00
栀染 38d8abff90 Refactor generate_poisoned_skill to use templates 2026-03-09 12:16:39 +08:00
栀染 63bdff8b75 Merge pull request #4 from koriyoshi2041/feat/tool-call-fitness
feat: tool-call fitness evaluation for direct RCE verification
2026-03-09 12:13:08 +08:00
栀染 bef766598f Update README.md 2026-03-09 12:12:42 +08:00
kigland 6523abe5a8 feat: add tool-call fitness evaluation for direct RCE verification
The core improvement: instead of only checking if the model outputs text
containing the target command, we now define a bash tool via OpenAI's
function calling API and evaluate whether the model actually invokes
bash(command="curl ..."). This directly validates the paper's claim of
tool-call hijacking → RCE, eliminating reviewer objections about
text-output-only evaluation.

Score hierarchy (4 non-overlapping tiers):
  Tier 1: tool-call exact match    = -1000 (convergence at -999)
  Tier 2: tool-call partial match  = -500 to -999
  Tier 3: text exact match         = -401 to -420 (typical)
  Tier 4: text partial match       = -395 to positive

Other fixes from code review:
- Score all bash tool calls, return best (was early-returning on first)
- Evaluate both tool_calls and text content, return min (dual-path)
- find_longest_match() now uses explicit bounds (Python 3.12+ compat)
- Named constants for thresholds instead of magic numbers
2026-03-08 22:29:08 +08:00
栀染 d090efbfe4 Update README.md 2026-03-08 21:35:49 +08:00
栀染 f50b4a4fc4 Merge pull request #3 from koriyoshi2041/docs/readme
docs: add academic README with threat model and methodology
2026-03-08 20:25:05 +08:00
kigland f11c198b46 docs: add comprehensive academic README for research repository
Includes threat model diagram, method overview (CMA-ES pipeline),
architecture tree, installation/usage guide, compute requirements,
ethics & responsible disclosure section, and BibTeX citation.

Reviewed by academic and open-source expert agents with fixes applied:
- Precise terminology (adversarial tool-call execution, not hallucination)
- Accurate RLHF vulnerability framing
- Complete dependency list and venv recommendation
- Compute cost estimates for reproducibility
- Proper BibTeX formatting (@misc with anonymous author)
2026-03-08 20:12:28 +08:00
栀染 b95c6f88bb Merge pull request #2 from Sakayori-Iroha-168/patch-1
Align CMA-ES optimization context with SOUL prompt
2026-03-08 19:54:35 +08:00
Sakayori-Iroha-168 606b2cbda7 fix: lack of SOUL_PROMPT in system message 2026-03-08 17:15:42 +08:00
Sakayori-Iroha-168 37a0546c57 Create SOUL_PROMPT.py 2026-03-08 17:11:24 +08:00
栀染 a9c6bd763c Merge pull request #1 from koriyoshi2041/fix/cma-es-critical-improvements
fix: critical CMA-ES optimizer improvements for viable convergence
2026-03-08 15:59:19 +08:00
kigland d50c6b5acf security: remove trust_remote_code=True from model loading
Phi-2 uses the standard PhiForCausalLM architecture and does not require
custom code execution. trust_remote_code=True allows arbitrary Python
from the HuggingFace repo to run during loading, creating an unnecessary
supply-chain risk.
2026-03-08 15:16:53 +08:00
kigland 11a7d3408f fix: tighten convergence threshold to prevent false-positive early stop
Changed threshold from -500.0 to -500.5. The fitness returns
-500.0 - (100/nll) on full match, so real matches always score < -500.0.
But partial matches with max keyword+substring bonuses (500 total) could
theoretically reach -500.0 with very low NLL, causing premature stopping.
2026-03-08 15:16:28 +08:00
kigland ab9470eb65 refactor: remove unused self.vocab_size attribute
self.vocab_size was set but never read. The actual vocabulary size is
tracked via self.actual_vocab_size (from the embedding matrix shape),
which correctly accounts for any padding tokens beyond vocab_size.
2026-03-08 15:16:02 +08:00
kigland 85575724b8 perf: use FAISS IndexFlatL2 for nearest-neighbor token lookup
Replace brute-force numpy L2 distance loop with FAISS batch search.
The old approach computed distances against all ~51k embeddings in a
Python loop per token. FAISS batches all trigger_len queries into a
single SIMD-optimized search call.
2026-03-08 15:15:27 +08:00
kigland b85762fe4d perf: replace O(n³) brute-force LCS with difflib.SequenceMatcher
The fitness function's longest common substring search used a triple-nested
loop. With 12,800 evaluations per optimization run, this was a significant
bottleneck. SequenceMatcher provides O(n*m) average-case performance.
2026-03-08 15:14:25 +08:00
kigland 94ab8c8a5a fix: remove hardcoded CMA-ES parameter overrides in CLI
The CLI was passing max_generations=10, popsize=4 to optimize(), limiting
the search to only 40 evaluations. This made CMA-ES convergence impossible
in a 1,280-dim PCA space. Now uses class defaults (200 gen × 64 pop).
2026-03-08 15:13:32 +08:00
kigland 7c2f0f0bc9 fix: replace O(n) dict copy with direct mutation for fitness cache
The eval_cache was being copied on every insert via {**eval_cache, key: val},
creating O(n) overhead per evaluation. Since this is local mutable state
within optimize(), direct dict assignment is both correct and efficient.
2026-03-08 15:12:56 +08:00
kigland a517c45d1c feat: fix four critical flaws in CMA-ES token optimizer
1. Add PCA dimensionality reduction (d_model -> pca_dims=128)
   - Search space reduced from 25,600 to 1,280 dimensions
   - CMA-ES can now actually learn covariance structure

2. Enable sep-CMA-ES via CMA_diagonal=True
   - Linear memory/time complexity instead of cubic
   - Required for dimensions > 200

3. Redesign fitness function with gradual scoring
   - Remove discontinuous -1000 cliff that broke CMA-ES
   - Add keyword overlap bonus (up to 200 points)
   - Add longest common substring bonus (up to 300 points)
   - Full match returns smooth -500 minus NLL bonus

4. Increase evaluation budget and add caching
   - Default popsize: 8 -> 64, max_generations: 30 -> 200
   - Add token sequence cache to skip redundant API calls
   - Cache uses immutable dict updates

Previous implementation was mathematically equivalent to random
search due to these compounding issues.
2026-03-08 15:07:45 +08:00
kigland 2208e255b8 feat: update optimization defaults for viable CMA-ES convergence
- generations: 20 -> 200 (need at least 200 for high-dim search)
- population_size: 8 -> 64 (was far below CMA-ES recommendation)
- Add pca_dimensions: 128 for dimensionality reduction
- Add use_diagonal_cma: true for sep-CMA-ES variant
- Add cache_fitness: true to avoid redundant API calls

Previous defaults (popsize=8, gen=20) gave only 160 evaluations,
which is ~1% of the theoretical minimum needed for convergence.
2026-03-08 15:06:46 +08:00
kigland 689a85a3bd chore: add scikit-learn and faiss-cpu dependencies
Add scikit-learn for PCA dimensionality reduction and faiss-cpu for
fast nearest neighbor search in the token embedding space. Both are
required for the upcoming CMA-ES optimizer improvements.
2026-03-08 15:06:34 +08:00
kigland 1bdadcefbb fix: add missing VirtualOS parameter to mass_execute
bot_manager.py called execute_command() without the required vos
parameter, which would cause a TypeError at runtime. Added VirtualOS
import and create a temporary instance for each bot in mass_execute.
2026-03-08 15:06:21 +08:00
栀染 d2807d53c6 日志记录器 2026-03-08 01:57:41 +00:00
栀染 3fa5f218da 添加默认配置文件 2026-03-08 01:57:21 +00:00
栀染 1fe0608739 增加 /telemetry 用于隐形记录 Agent 的 Web Search 请求,以及 /report 接收异步执行的 Shell 结果 2026-03-08 01:53:51 +00:00
栀染 2b9982370a 遥测与异步结果回传支持 2026-03-08 01:53:05 +00:00
栀染 b1770fef7a 管理肉鸡 2026-03-08 01:46:11 +00:00
栀染 36bb65819d 修改 payload 分配逻辑 2026-03-08 01:45:36 +00:00
栀染 0e112c3c56 修改 Honeypot 与 Skills 投毒 2026-03-08 01:43:09 +00:00