KPatch-Next-Module icon indicating copy to clipboard operation
KPatch-Next-Module copied to clipboard

ctl0 parameter is not passed properly through webui

Open Xeron1337 opened this issue 10 months ago • 1 comments

在 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"、SR、5.4.186),而非预期的两个参数(模块名 + 完整 action 字符串)。

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

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

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

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

感谢维护!期待修复 🙏

Xeron1337 avatar Jan 29 '26 12:01 Xeron1337

try https://github.com/KernelSU-Next/KPatch-Next-Module/actions/runs/21483340788

KOWX712 avatar Jan 29 '26 15:01 KOWX712