From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 278C63858C62; Tue, 11 Jul 2023 04:16:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 278C63858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689048985; bh=wqBctKx3v/yh58uGcGH6CyWXztkjGetE6/GsQ/2OVLI=; h=From:To:Subject:Date:From; b=eN3t8y1/aYPGhZakRpK48BDc41gQG8SyHwa7QMozMTT898qEqhqJmAWAO+iBt4WFK 5yoT7mNC5jfmH7GFMSAv1MlNAY1WuJsKGfQ4LNDzzGXtHcpzReuayO2/LpCC56+CAi Kl+VdFVCRw+bB4N9RgebFCaWKyBxOmCxMujygOvs= From: "gjduck at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug nss/30626] New: Empty passwd service line causes getpwuid() to crash (SEGV) Date: Tue, 11 Jul 2023 04:16:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nss X-Bugzilla-Version: 2.37 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gjduck at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30626 Bug ID: 30626 Summary: Empty passwd service line causes getpwuid() to crash (SEGV) Product: glibc Version: 2.37 Status: UNCONFIRMED Severity: normal Priority: P2 Component: nss Assignee: unassigned at sourceware dot org Reporter: gjduck at gmail dot com Target Milestone: --- Created attachment 14960 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14960&action=3Ded= it getpwuid.c Configuring "passwd" with an empty service line seems to cause getpwuid() to crash: __nss_configure_lookup("passwd", ""); struct passwd *pw =3D getpwuid(uid); // <---- SEGV See the attached PoC, tested with glibc-2.37 (latest dev head) on Ubuntu 23= .04. The steps to reproduce: $ gcc -o getpwuid getpwuid.c $ ./getpwuid Segmentation fault The same bug also can be induced by udpating "passwd" in /etc/nsswitch.conf with an empty service line: # /etc/nsswitch.conf ... passwd: However, testing using this method risks bricking your system. --=20 You are receiving this mail because: You are on the CC list for the bug.=