Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Security: predictable /tmp/nc_exit_status in postdetails - symlink clobber and TOCTOU

Đã đóng Phù hợp với người mới
#4,956 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Một pull request liên quan đã được merge.

  • #5035 của @dgibbs64 — đã merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, shell
Lĩnh vực
cli, security

Hướng nghiên cứu

Bắt đầu tại lgsm/modules/command_postdetails.sh, khoảng các dòng 63-65, và kiểm tra nhóm lệnh gọi termbin.com, ghi vào /tmp/nc_exit_status rồi đọc lại giá trị đó. Chạy ./gameserver pd và xác minh rằng việc xử lý trạng thái thoát không còn phụ thuộc vào một đường dẫn tạm thời dùng chung có thể dự đoán hoặc một race condition khi ghi/đọc.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Security report (responsible disclosure)

Predictable /tmp/nc_exit_status file in postdetails — symlink clobber + write/read race

Affected: lgsm/modules/command_postdetails.sh:63-65

	nc -w 10 termbin.com 9999
	echo $? > /tmp/nc_exit_status
} | tr -d '\n\0')
nc_exit_status=$(cat /tmp/nc_exit_status)

Two problems:

  1. Fixed world-writable path with no mktemp/O_EXCL/noclobber: a local attacker pre-creates /tmp/nc_exit_status as a symlink to a victim-owned file (e.g. ~/.bashrc). Next time the victim runs ./gameserver pd, the redirect truncates the target with 0\n — arbitrary file clobber as the victim user (CWE-59/CWE-377).
  2. TOCTOU between write and read: an attacker can swap the file contents between line 63 and line 65 to corrupt the status logic; the file is also shared across concurrent LGSM instances.
Suggested fix

Drop the temp file entirely:

nc -w 10 termbin.com 9999
nc_exit_status=$?

…inside the same command group, or use mktemp under ${tmpdir} if the split is required.

Fix

Implemented in PR #5035: https://github.com/GameServerManagers/LinuxGSM/pull/5035 (merged into develop for v26.4.0).

Ngôn ngữ chính
Shell
Star
4.9k
Fork
870
Merge trung bình
14 giờ 50 phút
Pull request đã merge (30 ngày)
109

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GameServerManagers/LinuxGSM

Tất cả issue của GameServerManagers/LinuxGSM

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.