Back to skill

Security audit

KWDB Build

Security checks for vulnerabilities and agentic risk

Overview

This KaiwuDB build/test skill is coherent, but its normal workflow includes unsafe cleanup and test scripts that can delete or execute unintended local files if paths are wrong.

Review before installing. Use this only in a trusted KaiwuDB checkout, confirm the exact source directory and GOPATH, and do not let it run cleanup until the agent shows the fully resolved paths to be deleted. The skill should be hardened to use validated absolute paths, quote variables, fail on cd errors, avoid broad rm -rf globs, and avoid executing or chmodding discovered files blindly.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
references/build-questions.md:13
Finding

Destructive cleanup commands can delete files outside the intended project

Content
View full analysis
Remediation
View remediation
&2; exit 1 ;; esac ``` 3. Enter the validated project directory and terminate if that operation fails: ```bash cd -- "$project_root" || exit 1 ``` 4. Replace `build*` with an exact allowlist such as `"$project_root/build"`. 5. Quote every path expansion, especially `"$GOPATH/native"`. 6. Before deletion, verify that each canonical target is a descendant of an approved root and is not `/`, the user's home directory, or the GOPATH root itself. 7. Prefer CMake-native cleanup where possible, such as `cmake --build "$build_dir" --target clean`. 8. Require explicit user confirmation before deleting directories outside the project root, including `"$GOPATH/native"`. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_golang_test.sh:4
Finding

Failed source-directory change can execute an unintended Makefile

Content
View full analysis
Remediation
View remediation
&2 exit 2 fi ``` 3. Canonicalize and validate the source directory before use. 4. Verify expected project markers, including the appropriate Makefile, before execution. 5. Quote every expansion and explicitly terminate if `cd` fails: ```bash BASE_DIR="$(realpath -- "$1")" [[ -d "$BASE_DIR/kwbase" ]] || exit 1 cd -- "$BASE_DIR/kwbase" || exit 1 ``` 6. Quote all Make variable values: ```bash make -f Makefile_ent test \ "LIBPROTOBUF=$GOPATH/native/kwdbts2/third_party/lib/libprotobuf.a" \ "PROTOBUF_INC=$GOPATH/native/kwdbts2/third_party/include" \ "PROTOBUF_C=$GOPATH/native/kwdbts2/third_party/bin/protoc" \ "TESTTIMEOUT=45m" \ "KWDB_LIB_DIR=$BASE_DIR/build/lib" ``` 7. Implement the documented open-source versus enterprise detection rather than always invoking `Makefile_ent`. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_unittest.sh:4
Finding

Failed test-directory change can execute unintended local binaries

Content
View full analysis
Remediation
View remediation
&2 fi done < <(find "$test_dir" -mindepth 1 -maxdepth 1 -type d -name '*.dir' -print0) ``` 6. Do not automatically grant executable permission. Test executables should already have the expected mode as a result of the trusted build process. 7. Validate each executable against the build manifest or require it to reside beneath the canonical build/test output directory before execution. ]]>
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (43)

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The skill claims strict confirmation requirements, CMake option restrictions, and support for multiple build/test flows, but the file mostly contains descriptive references rather than enforceable controls. When safety-critical behavior is declared but not operationally constrained, an agent may act outside the promised workflow, skip confirmations, or execute undocumented build/test actions.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

rm -rf build* is a broad destructive glob that can delete more than the intended build directory, including similarly named files or directories in the current working directory. Because the skill mandates this as part of its normal workflow, an agent could execute it in the wrong directory or with unexpected matches, causing significant data loss.

Content

Scanner excerpt · references/build-questions.md (reported line 17)May include surrounding context.

bash
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf log/ permanently deletes a directory using a relative path, making the effect dependent on the current working directory. In an agent-driven build flow, any directory confusion could result in unintended deletion of unrelated logs or data.

Content

Scanner excerpt · references/build-questions.md (reported line 18)May include surrounding context.

bash
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf install/ removes an installation directory recursively with no scope guard, backup, or warning. If the current directory is not what the skill expects, this can delete unrelated installed artifacts or user data.

Content

Scanner excerpt · references/build-questions.md (reported line 19)May include surrounding context.

md
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

rm -rf kwbase/.buildinfo targets a specific build artifact and is less risky than broader patterns, but it is still an irreversible deletion command with no path validation. If executed from an unexpected directory tree, it could still affect the wrong repository checkout.

Content

Scanner excerpt · references/build-questions.md (reported line 20)May include surrounding context.

md
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf kwbase/bin recursively removes a binary directory that may contain built artifacts a user wishes to preserve. In an automated skill, doing so without an explicit warning or precise workspace validation can lead to avoidable data loss.

Content

Scanner excerpt · references/build-questions.md (reported line 21)May include surrounding context.

md
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Removing qa/TEST_integration is a narrower cleanup action, but it still performs irreversible deletion based on a relative path assumption. The absence of path checks or user acknowledgment makes it unsafe in an agent execution context.

Content

Scanner excerpt · references/build-questions.md (reported line 22)May include surrounding context.

md
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native
rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Deleting kwbase/ui/yarn.installed is likely intended to reset frontend build state, but it remains an unchecked destructive filesystem operation. In the wrong directory context, even specific relative paths can remove unintended files.

Content

Scanner excerpt · references/build-questions.md (reported line 23)May include surrounding context.

md
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native
rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h
cd kwbase && GOPATH=${GOPATH} make clean -f Makefile_ent

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

rm -rf ${GOPATH}/native is particularly dangerous because it deletes a path derived from an environment variable that may be unset, malformed, or broader than intended. If GOPATH is incorrect or manipulated, the command could erase unrelated directories outside the repository workspace.

Content

Scanner excerpt · references/build-questions.md (reported line 24)May include surrounding context.

rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig rm -rf qa/TEST_integration rm -rf kwbase/ui/yarn.installed rm -rf ${GOPATH}/native rm -rf kwdbts2/roachpb/.cc kwdbts2/roachpb/.h cd kwbase && GOPATH=${GOPATH} make clean -f Makefile_ent

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h uses wildcards to delete multiple source-like files, creating risk if the matched files are not purely generated artifacts. In an automated build skill, wildcard deletions without generation checks can remove tracked or manually modified files.

Content

Scanner excerpt · references/build-questions.md (reported line 25)May include surrounding context.

rm -rf qa/TEST_integration rm -rf kwbase/ui/yarn.installed rm -rf ${GOPATH}/native rm -rf kwdbts2/roachpb/.cc kwdbts2/roachpb/.h cd kwbase && GOPATH=${GOPATH} make clean -f Makefile_ent

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

rm -rf log/ deletes a generic relative directory name that may not be scoped to the intended project root if the current directory is wrong. This creates avoidable risk of destroying unrelated logs or artifacts in the operator's environment.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 30)May include surrounding context.

bash
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

rm -rf install/ removes a generic relative directory and depends on the current working directory being correct. In an automated agent setting, that assumption is fragile and can lead to deletion of unrelated installation artifacts.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 31)May include surrounding context.

bash
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
88% confidence
Finding

rm -rf kwbase/.buildinfo targets a specific file in the repository and is less risky than the broader glob-based deletions, but it is still a destructive operation without path validation. If executed from an unexpected location or against the wrong checkout, it can remove state the user did not intend to destroy.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 32)May include surrounding context.

md
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
91% confidence
Finding

rm -rf kwbase/bin recursively deletes a directory that may contain built binaries or other artifacts important to the user. Without path validation and explicit warning, an agent can remove more than the user expects during a test workflow.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 33)May include surrounding context.

md
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Deleting kwbase/build/defs.mk and kwbase/build/defs.mk.sig is narrowly targeted, but still constitutes unvalidated destructive behavior. In an agent context, even small destructive steps should be constrained to a known workspace and disclosed to the user.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 34)May include surrounding context.

md
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

rm -rf qa/TEST_integration recursively removes a project subdirectory based on a relative path assumption. If the agent's working directory is not exactly the intended repository root, it may delete unrelated content with the same path.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 35)May include surrounding context.

md
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native
rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
87% confidence
Finding

rm -rf kwbase/ui/yarn.installed appears intended to remove a generated marker file, but it remains a destructive action without path or trust validation. The risk is lower than broad globs, yet still inappropriate to run blindly in an agent instruction set.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 36)May include surrounding context.

md
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native
rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h
cd kwbase && GOPATH=${GOPATH} make clean -f Makefile_ent

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

rm -rf ${GOPATH}/native is especially dangerous because it deletes outside the repository using an environment variable that may point to a shared developer workspace. This can destroy unrelated dependencies or user data and is more severe in an agent setting where environment state may be opaque.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 37)May include surrounding context.

rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig rm -rf qa/TEST_integration rm -rf kwbase/ui/yarn.installed rm -rf ${GOPATH}/native rm -rf kwdbts2/roachpb/.cc kwdbts2/roachpb/.h cd kwbase && GOPATH=${GOPATH} make clean -f Makefile_ent

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
92% confidence
Finding

rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h uses globs to delete generated source/header files, which can remove unintended files if the path contains hand-edited or unexpected content. In an automated agent flow, wildcard deletions are risky because they are hard to audit and easy to mis-scope.

Content

Scanner excerpt · references/cpp-unittest.md (reported line 38)May include surrounding context.

rm -rf qa/TEST_integration rm -rf kwbase/ui/yarn.installed rm -rf ${GOPATH}/native rm -rf kwdbts2/roachpb/.cc kwdbts2/roachpb/.h cd kwbase && GOPATH=${GOPATH} make clean -f Makefile_ent

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The mandated clean step includes 'rm -rf build*', a broad recursive deletion pattern that can remove more than the intended build directory depending on the current working directory and matching paths. Because the skill instructs this as a required pre-step, accidental or malformed execution could destroy unrelated local data.

Content

Scanner excerpt · references/golang-unittest.md (reported line 38)May include surrounding context.

bash
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The skill instructs unconditional recursive deletion of 'log/' without showing that the path is anchored to a validated repository root. If executed from an unexpected directory, this could delete unrelated logs and operational artifacts outside the intended project scope.

Content

Scanner excerpt · references/golang-unittest.md (reported line 39)May include surrounding context.

bash
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

The command removes 'install/' recursively as a mandatory cleanup action, but the instruction does not bind it to a verified project root at execution time. In a mis-scoped shell context, this can wipe unrelated installation artifacts or packaging outputs.

Content

Scanner excerpt · references/golang-unittest.md (reported line 40)May include surrounding context.

md
rm -rf build*
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
89% confidence
Finding

Removing 'kwbase/.buildinfo' is narrower than the other cleanup commands, but it is still a destructive file deletion performed without explicit path canonicalization safeguards. The risk is lower because the target is a specific build artifact path, yet it remains unsafe if execution context or repository path assumptions are wrong.

Content

Scanner excerpt · references/golang-unittest.md (reported line 41)May include surrounding context.

md
rm -rf log/
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

The command recursively deletes 'kwbase/bin', which may contain built binaries or tooling, and the instruction makes this mandatory without scoped execution safeguards. If the repository root or working directory is misidentified, important binaries in an unintended location could be removed.

Content

Scanner excerpt · references/golang-unittest.md (reported line 42)May include surrounding context.

md
rm -rf install/
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
91% confidence
Finding

Deleting 'kwbase/build/defs.mk' and its signature file is aimed at resetting generated build metadata, but it still uses destructive file removal without path-safety checks. The scope is relatively narrow, so impact is lower than wildcard or top-level directory removal, though misexecution could still affect unintended files if path assumptions fail.

Content

Scanner excerpt · references/golang-unittest.md (reported line 43)May include surrounding context.

md
rm -rf kwbase/.buildinfo
rm -rf kwbase/bin
rm -rf kwbase/build/defs.mk kwbase/build/defs.mk.sig
rm -rf qa/TEST_integration
rm -rf kwbase/ui/yarn.installed
rm -rf ${GOPATH}/native
rm -rf kwdbts2/roachpb/*.cc kwdbts2/roachpb/*.h