Rapid7 Vulnerability & Exploit Database

Bitbucket Git Command Injection

Back to Search

Bitbucket Git Command Injection

Disclosed
08/24/2022
Created
09/21/2022

Description

Various versions of Bitbucket Server and Data Center are vulnerable to an unauthenticated command injection vulnerability in multiple API endpoints. The `/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/archive` endpoint creates an archive of the repository, leveraging the `git-archive` command to do so. Supplying NULL bytes to the request enables the passing of additional arguments to the command, ultimately enabling execution of arbitrary commands.

Author(s)

  • TheGrandPew
  • Ron Bowes
  • Jang
  • Shelby Pace

Platform

Linux

Architectures

x86, x64, cmd

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/http/bitbucket_git_cmd_injection
msf exploit(bitbucket_git_cmd_injection) > show targets
    ...targets...
msf exploit(bitbucket_git_cmd_injection) > set TARGET < target-id >
msf exploit(bitbucket_git_cmd_injection) > show options
    ...show and set options...
msf exploit(bitbucket_git_cmd_injection) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;