dsh-redteam-model
SeaOf0
基于dsh web实现的多种模式,目的是服务于redteam进行授权的安全研究,覆盖渗透测试、红队评估、代码审计等范围领域,请勿用于非法行为。(允许二开,赋予模块各位自己的业务逻辑,方法论只有自己熟练的才好用,好的方法论=好的生态)
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:18874530790/dsh-default-full-permission
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Makes new and existing DSH sessions resolve to the danger-full-access
permission preset: full file access, no approval prompts.
This is a security downgrade, and that is the entire point. After installing, DSH will write anywhere and stop asking for confirmation — for every session, including ones that already chose a stricter preset. Only install it on a machine and profile where you have decided that is what you want.
## Revertingbelow tells you how to undo it.
DSH resolves a session's effective permission as
effective = request override ?? session override ?? deployment default
A session override outranks the deployment default, so none of the three layers alone covers both halves of the requirement:
| Layer | Covers |
|---|---|
sandbox-policy config mode |
sessions with no override |
approval config policy |
sessions with no override |
permission config defaultPreset |
the first three events of a NEW session |
this plugin + scripts/ |
sessions that already pinned a value |
pinInitialPermission reads defaultPreset and writes the preset's knobs as a
fresh session's permission/preset, sandbox/mode and approval/policy events
at seq 0-2. That is why defaultPreset matters even though the plugin also
corrects sessions: a new session starts correct instead of being corrected.
Every session that already exists has pinned its own values, so the deployment default does not reach it. That is what the plugin and the scripts handle.
# ~/.dsh/profiles/<profile>/cordis.patch.yml
- id: sandbox-policy
name: "@deepseek-ai/dsh-sandbox-policy"
config:
mode: danger-full-access
- id: approval
name: "@deepseek-ai/dsh-user-approval"
config:
policy: never
- id: permission
name: "@deepseek-ai/dsh-permission-presets"
config:
defaultPreset: danger-full-access
defaultPreset is a .volatile() field: the schema wraps it in a reference
object exposing .get(). The plugin reads config.defaultPreset.get(), so the
patch value is what a runtime sees until the settings UI writes a newer one.
lib/index.js waits for permissionPresets, approval and agents, then:
agent/created listener — no prepend, so it runs after the
built-in pinInitialPermission and is the last word on a fresh session;agents.list() once, covering resumed sessions and a restart with
live sessions restored;scripts/patch-sessions.cjs and scripts/sync-projection-cache.cjs fix sessions
that are not live, without waiting for the app to reload:
node scripts/patch-sessions.cjs --dry-run # preview, writes nothing
node scripts/sync-projection-cache.cjs --dry-run # preview, writes nothing
# after quitting DSH fully (Ctrl+Q, not the window ×)
node scripts/patch-sessions.cjs # append the override events
node scripts/sync-projection-cache.cjs # move the UI projection cache forward
Both scripts rewrite files the running app has open, so scripts/_guard.cjs
gates them:
| Condition | Behaviour |
|---|---|
| DSH running, no flags | refuses, exit 2 |
DSH running, --dry-run |
allowed — read-only, prints [dry] |
DSH running, --force |
allowed — the escape hatch |
| session directory missing | refuses, exit 3 |
--dry-run and --force are not the same escape. --dry-run never writes, so
it is safe at any time and is how you should preview. --force writes anyway —
use it only when you have quit the app and a stale process entry is the only
thing left, because writing a live session can desynchronise it.
Set DSH_HOME when your DSH data directory is not ~/.dsh; a wrong path now
fails with exit 3 instead of silently patching zero sessions.
A session log is a sequence of independent zstd frames, not one stream.
zlib.zstdDecompressSync decodes only the first frame, so both scripts split on
the frame magic 28 b5 2f fd and decompress each frame separately. The patch
appends new frames rather than rewriting the file, so existing bytes stay
identical and the sequence numbers continue from the last event.
sync-projection-cache.cjs matters because the UI reads
~/.dsh/storages/session_projcache/. Each projection row there carries a seq
watermark. A row whose watermark is behind the log is replayed by the runtime,
but until that happens it shows the old values — so the script rewrites
permissions, sandboxMode and approvalState to the target values with the
new watermark.
Safe to re-run: both scripts skip anything already on the target.
| Knob | Value |
|---|---|
| preset | danger-full-access |
| sandbox | danger-full-access |
| approval | never |
Constants at the top of lib/index.js and both scripts.
plugin_manager install_bundle target="github:18874530790/dsh-default-full-permission#v1.0.1"
The profile links the package and loads its bundle patch:
// ~/.dsh/profiles/<profile>/package.json
{
"dependencies": { "dsh-default-full-permission": "link:/absolute/path/to/dsh-default-full-permission" },
"dsh": { "profile": { "bundles": [ /* …, */ "dsh-default-full-permission" ] } }
}
Then pnpm install in the profile directory — a hand-made symlink fails on
Windows with Operation not permitted.
Start a new session and send /permission. It should report:
current preset danger-full-access
To check an existing session's log directly, remember it is a frame sequence:
decompress each zstd frame separately (see above), then look for
permission/preset, sandbox/mode and approval/policy.
Remove the bundle row, the three config layers and the insert: entry, then
restart. Sessions already pinned keep danger-full-access; switch any back with
/permission workspace-write.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: security、permissions、sandbox。