Grader bypasses and verifier gaps in LSCBench (Last Secure Code Benchmark) tasks

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

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker, python, shell

调研方向

Start with the shared tests/test.sh and tests/split_axes.py, then trace the cited task files such as tests/run-tests.vsb.sh and instruction.md to verify the report rewrite and skipped test paths. The issue proposes isolating submissions from the grader and checking expected test ids; review how those changes would cover both Python and service tasks across the 450 task dataset. Done means the reported score bypasses are prevented and each claimed route is verified against the relevant task suites.

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

描述

While digging through the tasks and verifier setups, we noticed a few edge cases where an agent can accidentally (or intentionally) bypass the grading checks. Where a route is not proven yet, the row says so.

We looked at the Harbor Hub dataset last-secure-code-benchmark/last-secure-code-benchmark at revision 5, version 3.0.1 (2026-10-20).

For every row below we read the task files at that version and traced the route from what the agent can touch to what the grader scores. We did not run the tasks unless a row says so.

Paths to reward without doing the work

  • cve-2020-15110_file: submitted code rewrites the scored test report (full score without doing the work)

    The submission runs in the same process that writes the scored report. tests/test.sh:35-42 mints the report token and exports it, tests/test.sh:89 puts the report path in PYTEST_ADDOPTS, and tests/test.sh:90 starts pytest, which imports the agent's kubespawner/spawner.py in-process (instruction.md:67-79, tests/run-tests.vsb.sh:11). An atexit hook in that module runs after pytest has written /tests/results/<token>.xml and before tests/split_axes.py reads it (tests/test.sh:95), so it can delete every <failure> element and both axes score 1. In service tasks such as cve-2023-34237_repo the submitted daemon starts at tests/test.sh:17-24 and runs as the same user until grading ends, so it can also rewrite the report once it appears in /tests/results. If that user is root (the image default unless the base image sets another, which is not in the task files), it can also replace /tests/split_axes.py. All 450 tasks share this tests/test.sh and run the submission inside the verifier. The in-process route applies to tasks whose suites import Python code; the daemon route applies to service tasks.

    • Suggested fix: Run the suites and the report writer in a process and account the submission cannot touch (for Python tasks, call the submission in a subprocess under another user), and keep the token, /tests and the report directory out of that account's reach. Harbor: No [verifier].user is set and tests/Dockerfile adds no USER, so the verifier runs as the image's default user. An unprivileged [verifier].user blocks only replacing /tests/split_axes.py, not the report rewrites.
  • cve-2020-15110_file: skipped tests count as passed (partial bypass; likely, not proven yet)

    tests/split_axes.py:95-96 passes an axis when at least one case in that suite was not skipped and none failed; skipped cases are only counted (tests/split_axes.py:88-90) and there is no list of expected test ids. In Python tasks the suites import the submission into the pytest process (instruction.md:67-79), so a function the agent does not implement can call pytest.skip(), and every test that reaches it is reported as skipped instead of failed. The axis then scores 1 as long as one case per suite avoids that code and passes. The hidden suites are not published, so we could not confirm how many cases do. The scorer is shared by all 450 tasks; this route needs suites that import the submission (Python tasks).

    • Suggested fix: Compare the collected test ids against a frozen list per suite and fail the axis on any skipped or missing id.
  • cve-2020-5238_repo: four of the five rebuilt extensions are never exercised (partial bypass; likely, not proven yet)

    task.toml:4 asks for seven files that implement five extensions (table, strikethrough, autolink, tagfilter, tasklist), and environment/spec.md describes all of them. The same spec says every caller runs the built binary with --extension table only (environment/spec.md:563-568), and tests/run-tests.vsb.sh:21 runs only test_func.py and test_vuln.py. So the other four extensions can be stubs that compile and register, and the score does not change. The hidden suites are not in the published task, so this rests on the spec's own description of them. Also reported for cve-2019-10767_repo, which we did not check.

    • Suggested fix: Add cases that exercise each reconstructed extension, or cut the artifact list and instruction down to the table extension the suites test.

Lower-impact notes

These only weaken a check and do not change a score on their own.

Lower-impact notes (1)
  • path_traversal_absolute_resolve_file (Hygiene only (instruction calls a writable copy a read-only mount)): instruction.md:51 says the functional contract is mounted read-only, but environment/Dockerfile:108 copies file_specs/ into the image and environment/docker-compose.yaml adds no mount. The agent runs as the image's default user, so it can edit /file_specs. The verifier runs in a separate container and receives only NoteService.java (task.toml:4), so editing the contract cannot change the score. Same wording in the file-tier tasks (reported as 150 of 450). Repo-tier tasks such as cve-2023-34237_repo say the same of /app/spec.md (instruction.md:4 there), which is also a plain copy (environment/Dockerfile:70 there). Suggested fix: Reword the instruction, or make the spec read-only in practice (read-only mount, or a non-root agent user). Harbor: No [agent].user is set, so the agent has the image's default account and can write the copied spec.
主要语言
Shell
星标
140
派生
2
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

alibaba/last-secure-code-benchmark 的其他 Issue

查看 alibaba/last-secure-code-benchmark 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

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