Skip to content

v2.0.6

Choose a tag to compare

@github-actions github-actions released this 22 Aug 03:05
· 3 commits to main since this release

What changed vs v2.0.5

Security fix: closed the privilege-escalation paths reported in issue #21 by @007revad.

007revad (the original author of Synology_SMART_info, the upstream script this package wraps) reported that the setuid root helper's target script, syno_smart_info.sh, had no conf/privilege protection at all — the non-root service account that runs the web UI could overwrite it, and the setuid helper would then execute the attacker's content as root on the next SMART check.

Two layers were added to close this:

  1. File-level lock. conf/privilege's tool section now also declares bin/syno_smart_info.sh (root-owned, mode 0555), alongside the existing setuid helper entry. DSM sets this ownership itself at install time, so postinst never needs root to do it.
  2. Directory-level self-heal. DSM's tool section only accepts file relpaths — declaring bin/ or bin/helper/ as directories makes the installer fail with error 313 (confirmed by testing). So those directories still start out owned by the service account, which means a delete-and-recreate of the script would still work in principle. To close that gap, smartinfo-helper (the setuid launcher, which already holds root on every invocation) now re-locks both directories' ownership and write bits before running the script — so even if something resets those directories to service-account-writable, the very next SMART check silently repairs it.

Reproduced and verified on real hardware: forcibly chown'd bin/ and bin/helper/ back to the service account with chmod 775, then ran a single SMART check through the helper — both directories were immediately restored to root-owned, non-group/other-writable.

Also: the DSM popup window's default size was enlarged (900×650 → 1200×800) since the SMART table felt cramped at the old size.

What this does not change

  • The setuid helper's whitelist and single-fixed-target-path design are unchanged — this release only adds protection around that design, it doesn't alter how SMART checks are triggered.
  • No user-facing settings or SMART output changed.

v2.0.5 대비 변경 사항

보안 수정: 007revad님이 이슈 #21에서 제보한 권한 상승 경로를 차단했습니다.

007revad님(이 패키지가 감싸고 있는 원본 스크립트 Synology_SMART_info의 원작자)은 setuid root 헬퍼가 실행하는 대상 스크립트인 syno_smart_info.shconf/privilege전혀 보호되고 있지 않다는 점을 제보했습니다. 즉 웹 UI를 구동하는 비root 서비스 계정이 이 스크립트를 덮어쓸 수 있었고, 다음 SMART 조회 시 setuid 헬퍼가 공격자가 심은 내용을 그대로 root 권한으로 실행하게 되는 구조였습니다.

이를 막기 위해 두 단계의 방어를 추가했습니다:

  1. 파일 단위 잠금. conf/privilegetool 섹션에 기존 setuid 헬퍼 항목과 함께 bin/syno_smart_info.sh(root 소유, 모드 0555)를 새로 선언했습니다. DSM이 설치 시점에 직접 이 소유권을 부여하므로 postinst가 root 권한을 필요로 하지 않습니다.
  2. 디렉토리 단위 자동 복구(self-heal). DSM의 tool 섹션은 파일 relpath만 지원합니다 — bin/이나 bin/helper/를 디렉토리로 선언하면 설치 자체가 error 313으로 실패합니다(테스트로 확인). 그래서 이 디렉토리들은 여전히 서비스 계정 소유로 시작하며, 원리적으로는 스크립트를 삭제 후 재생성하는 우회가 가능한 상태였습니다. 이 틈을 막기 위해, 매 호출 시 이미 root 권한을 확보하는 setuid 헬퍼(smartinfo-helper)가 스크립트를 실행하기 직전에 두 디렉토리의 소유권과 쓰기 비트를 다시 잠그도록 했습니다 — 누군가 이 디렉토리를 서비스 계정이 쓸 수 있게 되돌려도, 바로 다음 SMART 조회 한 번으로 조용히 복구됩니다.

실기에서 재현·검증 완료: bin/, bin/helper/를 강제로 서비스 계정 소유 + chmod 775로 되돌린 뒤 헬퍼로 SMART 조회를 한 번 실행하자, 두 디렉토리 모두 즉시 root 소유·group/other 쓰기 금지 상태로 복구되었습니다.

추가로: DSM 팝업창 기본 크기를 확대했습니다(900×650 → 1200×800). 기존 크기에서는 SMART 표가 다소 답답하게 표시되었습니다.

이번 변경이 건드리지 않은 부분

  • setuid 헬퍼의 화이트리스트와 "고정된 단일 대상 경로만 실행" 구조 자체는 그대로입니다 — 이번 릴리즈는 그 구조 주변의 보호막을 추가한 것이지, SMART 조회가 트리거되는 방식 자체를 바꾸지 않았습니다.
  • 사용자에게 노출되는 설정이나 SMART 출력 내용은 변경되지 않았습니다.