Created attachment 18996 [details] original report Tristan (TristanInSec@gmail.com) reports (as attached): `_spoolss_SetPrinter` in `source3/rpc_server/spoolss/srv_spoolss_nt.c` handles level 3 by calling `update_printer_sec()` without checking if `secdesc_ctr->sd` is NULL. Level 2 has the correct check: case 2: if (r->in.secdesc_ctr->sd) // level 2: correct NULL check result = update_printer_sec(...); case 3: return update_printer_sec(...); // level 3: no check Inside `update_printer_sec()`, `sec_desc_merge()` is called at line 6352 with the NULL sd. `sec_desc_merge()` in `libcli/security/secdesc.c:137` immediately dereferences it: owner_sid = new_sdb->owner_sid ? ... // new_sdb is NULL -> crash Same root cause as findings 5 and 7: `sec_desc_buf.sd` is NULL when `sd_size=0`. ## Trigger Send spoolss_SetPrinter with level=3 and `sec_desc_buf { sd_size=0, sd=NULL }` on a printer handle with PRINTER_ACCESS_ADMINISTER.
Maybe "print server administrator can crash the print server" is not a security bug. In any case the suggested CVSS of 4.9 (AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H), which falls under our threshold for a security release.
Fair point Douglas. Printer admin crashing the print server is a pretty limited impact scenario, and I haven't seen secondary entry point. Since this is the exact same root cause as bugs 16088 (SAMR, CVSS 6.5) and 16090 (SRVSVC, CVSS 6.5), it would make sense to fix all three as part of the same commit or patch series: "add NULL checks for wire-deserialized sec_desc_buf.sd before dereferencing." The level 2 handler in the same function already has the correct pattern, so the level 3 fix is a one-line addition matching that existing check. Even if this one does not warrant a separate advisory, fixing it alongside the others prevents a future reporter from filing the same bug class again.
(In reply to TristanInSec from comment #3) > Even if this one does not warrant a separate advisory, fixing it alongside the others prevents a future reporter from filing the same bug class again. Yes. We will keep this embargoed in the meantime.
Created attachment 19023 [details] Patch proposal - s3:spoolss: check for NULL security descriptor in update_printer_sec()
Hi, Just to follow up on this case. Please also let me know if I can do anything else. Best, Tristan
Thank you very much for providing a patch. I think we should modify line 6242 if (secdesc_ctr == NULL || secdesc_ctr->sd == NULL) { DBG_DEBUG("Invalid security descriptor"); ...
Created attachment 19126 [details] Patch proposal - v2 - s3:spoolss: check for NULL security descriptor in update_printer_sec()
(In reply to Andreas Schneider from comment #7) Hi Andreas, Good suggestion thanks! Combining both checks into the existing guard is cleaner. Updated patch (v2) attached, merging the sd NULL check into the existing secdesc_ctr NULL check and using DBG_DEBUG.
lgtm now :-)
(In reply to Andreas Schneider from comment #10) Thanks for the review
[Bulk message on a number of bugs being made public at once] The embargo is being removed from this bug. That is not to say that the issue is not a real bug, but some things are better dealt with in public, where the normal process is both more available to external contributors and much, much more efficient. If you have a patch for this issue, please do contribute it via our normal GitLab process: https://wiki.samba.org/index.php/Contribute#Submitting_Patches_via_GitLab All patches to Samba must follow our copyright policy: https://www.samba.org/samba/devel/copyright-policy.html Thanks to all who report issues to Samba, we value your patience as we, along with the rest of the Open Source and Free Software communities, work though the reported issues.