Cyber Risks · Trail of Bits Blog

Readline crime: exploiting a SUID logic bug

Summary: A researcher found a logic bug in the readline library that partially discloses file contents when parsing the file named in the INPUTRC environment variable, and used it to leak lines from /etc/shadow through the SUID binary chfn. The bug was introduced in util-linux 2.30-rc1 in 2017 and patched in February 2022, with readline support removed from chfn; Debian, Red Hat, and Ubuntu ship chfn from a different package and are unaffected, and Arch was the only distro found to have a package containing a SUID executable that loads readline by default.

Key Takeaway: The leak works because SSH private keys stored at /home/user/.ssh/id_rsa match the parsing path that echoes a line back on error, which could let an attacker move laterally on a box where sshd is running and a given user can log in.

Read the original at Trail of Bits Blog ↗