Skip to content

ctl0 parameter is not passed properly through webui #34

Description

@Xeron1337

kpm.js 中的 async function controlModule(moduleName, action) 函数中,调用 exec 时对 action 参数的拼接方式存在安全隐患和功能缺陷:

const result = await exec(`kpatch kpm ctl0 "${moduleName}" ${action}`, { env: { PATH: `${modDir}/bin` } });

此处 action 被直接拼接到 shell 命令中,未用引号包裹。当 action 包含空格(例如传递类似 SR 5.4.186 的字符串)时,shell 会将其按空格分割为多个参数,导致命令解析错误。

例如:

controlModule("spoofUuname", "SR 5.4.186")

实际执行的命令变为:

kpatch kpm ctl0 "spoofUuname" SR 5.4.186

这会被解释为传入了 三个 参数("spoofUuname"SR5.4.186),而非预期的两个参数(模块名 + 完整 action 字符串)。

建议修复:
action 也用双引号包裹,避免 shell 分词:

const result = await exec(`kpatch kpm ctl0 "${moduleName}" "${action}"`, { env: { PATH: `${modDir}/bin` } });

或者更安全地使用参数数组形式(如果 exec 支持),避免 shell 解析。

影响:
此问题导致无法向 KPM 模块传递包含空格的控制参数,严重影响某些模块(如 spoofUname)的正常使用。

感谢维护!期待修复 🙏

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions