update.php fixes#2685
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
12cd4d4 to
87e4323
Compare
Verifying this change (not committed)One-line hardening of Offline check from the repo root — should print php -d short_open_tag=On -r '
error_reporting(0);
$_SERVER["DOCUMENT_ROOT"] = getcwd()."/emhttp";
$_POST = ["#command" => "../../../../../../bin/echo", "#arg" => ["PWNED"]];
chdir("emhttp"); include "update.php";
' | grep -q PWNED && echo "NOT contained" || echo "blocked"On a running server: an authenticated POST with |
87e4323 to
d0597c9
Compare
Re-check the resolved #command path stays inside the document root before executing it, so an authenticated request cannot use realpath() traversal (e.g. starting at $docroot then '../') to run a binary outside the webgui. Refs: OS-489
d0597c9 to
286101e
Compare
Restrict
update.php#filewrites to the expected configuration roots (/boot/config,/etc/wireguard) so a write cannot land outside config storage via an absolute path or...realpath()(collapsing../symlinks) and range-check it with a sharedin_safe_path()helper.in_safe_path()intoWrappers.phpsoupdate.phpandFileUpload.phpshare one implementation (drops the duplicate copy inFileUpload.php).update.phpand asserts out-of-root targets are refused while legitimate/boot/configwrites still succeed.Relative
#filepaths are unaffected (still placed under/boot/config/plugins/).