A critical vulnerability (CVE-2022-36804) in Atlassian Bitbucket Server and Data Center could be exploited by unauthorized attackers to execute malicious code on vulnerable instances.
Bitbucket Server and Data Center are used by software developers around the world for source code revision control, management and hosting.
CVE-2022-36804 is a command injection vulnerability in multiple API endpoints of Bitbucket Server and Data Center.
“An attacker with access to a public repository or with read permissions to a private Bitbucket repository can execute arbitrary code by sending a malicious HTTP request,” Atlassian explained. Which subsequent actions the attacker can take depends on the permissions associated with the exploited application.
All versions of Bitbucket Server and Data Center released before versions 7.6.17, 7.17.10, 7.21.4, 8.0.3, 8.1.2, 8.2.2, and 8.3.1 are vulnerable, but Bitbucket installations hosted by Atlassian are not affected.
Fixing the issue before attackers start exploiting it
Users are advised to upgrade to their self-hosted installations to plug the security hole.
“If you have configured Bitbucket Mesh nodes, these will need to be updated with to the corresponding version of Mesh that includes the fix,” the company added.
“If you’re unable to upgrade Bitbucket, a temporary mitigation step is to turn off public repositories globally by setting feature.public.access=false as this will change this attack vector from an unauthorized attack to an authorized attack. This can not be considered a complete mitigation as an attacker with a user account could still succeed.”
Of course, nothing’s stopping attackers from reverse-engineering the provided patches to glean enough information into the flaw to create a working exploit, so users should act quickly to block this avenue of attack.
UPDATE (September 20, 2022, 07:55 a.m. ET):
Several GitHub users published PoC exploits for CVE-2022-36804, but be careful because some of them may be fake. Garret singled out one working PoC on Monday, and reiterated his plan to publish a write-up about the flaw.
UPDATE (September 21, 2022, 05:10 a.m. ET):
There’s also a Metasploit module for exploiting the flaw, and Rapid7 recommends that organizations patch their Bitbucket instances as quickly as possible using Atlassian’s guide, because this vulnerability is very likely to be exploited in the near future. “Organizations can also block network access to Bitbucket as a stop-gap solution,” they added.