Linux PAM 1.1.0 - MOTD File Tampering Privilege Escalation

Linux PAM (Pluggable Authentication Modules) is a flexible authentication framework that allows system administrators to integrate the interaction between applications and various authentication mechanisms without having to modify the applications themselves. It employs a modular architecture that enables developers and system administrators to use PAM modules to define how user authentication should be performed.

The main objectives of PAM are:

  • Decouple applications from authentication mechanisms: This allows applications to operate independently of the underlying authentication technology.
  • Unified authentication management: It provides a unified authentication configuration interface for easy management by system administrators.
  • Flexibility and extensibility: New authentication methods can be added easily without modifying existing applications.

Linux PAM typically consists of the following components:

  • PAM Library: Applications in the system make authentication requests through this library.
  • PAM Configuration Files: Usually located in the /etc/pam.d/ directory, these files define specific authentication policies and modules.
  • PAM Modules: These are plugins that implement specific authentication mechanisms, such as password-based, one-time passwords, fingerprint recognition, etc.

Each PAM module can independently control one or more aspects of authentication (auth), account management (account), session management (session), and password management (password). When an application needs to authenticate a user, it calls the PAM library, which in turn uses one or more PAM modules according to the instructions in the configuration files.

In the mentioned version of Linux PAM 1.1.0, there is a privilege escalation vulnerability through MOTD (Message of the Day) file tampering. This means that, under certain configurations, users with otherwise limited permissions could potentially escalate their privileges by tampering with the MOTD file, thereby gaining higher system access than they are normally permitted. Such vulnerabilities typically require timely patches and system updates to fix, in order to maintain system security.


HackTheBox environment and writeup: Popcorn