Security Experts:

Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Vulnerabilities

Critical Vulnerability Patched in PHP Package Repository

A critical remote code execution vulnerability was recently addressed in packagist.org

A critical remote code execution vulnerability was recently addressed in packagist.org, a large PHP package repository, a security researcher reveals.

An open source project, Packagist is the default package server behind Composer, a tool for dependency management in PHP, as it aggregates public PHP packages installable with the utility. The packagist.org site helps users search for packages and lets Composer know where to get the code from.

Statistics on the website show that Packagist has delivered billions of packages since its inception in 2012, and that it is currently serving around 400 million package installs per month.

What security researcher Max Justicz discovered was that there was a “big text field on the site” that allowed anyone to type $(execute me), which would result in the command being executed in a shell.

The issue, Justicz says, resided in the package repository’s functionality that allows users to upload packages.

“You upload packages to Packagist by providing a URL to a Git, Perforce, Subversion, or Mercurial repository. To identify what kind of repository the URL points to, Packagist shells out to git, p4, svn, and hg, with application-specific commands that include this URL as an argument,” the researcher notes.

However, when checking the provided URL, Packagist was improperly escaping input. Any commands an attacker would have provided were executed twice.

“The Packagist team quickly resolved this issue by escaping the relevant parameters in the Composer repository,” Justicz reveals.

The security researcher, who over the past year discovered multiple issues on popular repositories, warns of the high probability that package manager servers could be compromised in the future.

“The flaw could have been easily avoided by setting parameters on what users can input into text boxes. Without parameters, text boxes become entry points for bad actors to execute malicious commands in order to access the server and, once there, potentially gain access to credentials that will let them hop from one server to another while harvesting sensitive information,” Mike Bittner, Digital Threat Analyst for The Media Trust, told SecurityWeek in an emailed comment.

“Developers should make security a priority all throughout a product’s lifecycle stages, from concept to manufacturing to retirement. Website operators should police all their website third-party code providers to ensure their activities align with policies, and scan their sites to identify and obstruct unauthorized code,” Bittner concluded.

Related: Critical Vulnerabilities Patched in Apache CouchDB

Related: Several Vulnerabilities Patched in RubyGems

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Click to comment

Expert Insights

Related Content

Cloud Security

VMware vRealize Log Insight vulnerability allows an unauthenticated attacker to take full control of a target system.

IoT Security

Lexmark warns of a remote code execution (RCE) vulnerability impacting over 120 printer models, for which PoC code has been published.

Mobile & Wireless

Apple rolled out iOS 16.3 and macOS Ventura 13.2 to cover serious security vulnerabilities.

Email Security

Microsoft is urging customers to install the latest Exchange Server updates and harden their environments to prevent malicious attacks.

Mobile & Wireless

Technical details published for an Arm Mali GPU flaw leading to arbitrary kernel code execution and root on Pixel 6.

Vulnerabilities

Security researchers have observed an uptick in attacks targeting CVE-2021-35394, an RCE vulnerability in Realtek Jungle SDK.

Application Security

Drupal released updates that resolve four vulnerabilities in Drupal core and three plugins.

Vulnerabilities

Google has awarded more than $25,000 to the researchers who reported the vulnerabilities patched with the release of the latest Chrome update.