Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLab FOSSGitLab FOSS
  • Issues
  • #35212
Closed
Open
Created Jul 17, 2017 by Brian Neel@briannContributor

Remote Command Execution (RCE) in project import

This is from the Recurity whitebox testing. I've verified that this works. You can even use:

ssh://-oProxyCommand=[snip]/a

To execute arbitrary shell commands using backticks.


Via the Import Repository functionality it is possible to execute commands on the GitLab server under the git user.

Reproduction steps:

  1. Click New Project, fill out a project name.
  2. Click git Repo by URL.
  3. Paste a URL like ssh://-oProxyCommand=[snip]/a.
  4. Click Create project

Now the ruby -esleep 1000 can be observed running on the GitLab server under the git user.

As a short term mitigation gitlab-ee/app/validators/addressable_url_validator.rb should exclude the ssh entry in DEFAULT_OPTIONS = { protocols: %w(http https ssh git) }.freeze.

However the main problem lies in git clone, we've investigated this issue a bit further, and figured that it's possible to create git repositories which will execute arbitrary commands upon recursive checkout. If you like to we can report this issue to the git maintainers.


Edited Aug 10, 2017 by Brian Neel
Assignee
Assign to
Time tracking