Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Issue with thinc package from pypi.org #735

Open
rakovskij-stanislav opened this issue Aug 4, 2022 · 0 comments
Open

Security Issue with thinc package from pypi.org #735

rakovskij-stanislav opened this issue Aug 4, 2022 · 0 comments

Comments

@rakovskij-stanislav
Copy link

Hello! Found a security issue in your package in pypi:
https://pypi.org/project/thinc/

Affected versions of package:

  • 6.10.4.dev0 (released Oct 14, 2018)

There's an unmet dependency on module "cupy-cuda10" if you will try to install these versions of sentry-sdk with extra-mode "cuda10".

python -m pip install --upgrade thinc[cuda10]==6.10.4.dev0
Collecting thinc[cuda10]==6.10.4.dev0
  Downloading thinc-6.10.4.dev0.tar.gz (7.9 MB)
     ---------------------------------------- 7.9/7.9 MB 12.3 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting numpy>=1.7.0
  Downloading numpy-1.23.1-cp310-cp310-win_amd64.whl (14.6 MB)
     ---------------------------------------- 14.6/14.6 MB 6.5 MB/s eta 0:00:00
Collecting msgpack<1.0.0,>=0.5.6
  Downloading msgpack-0.6.2.tar.gz (119 kB)
     ---------------------------------------- 119.1/119.1 kB 6.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting msgpack-numpy<0.4.4.0
  Downloading msgpack_numpy-0.4.3.2-py2.py3-none-any.whl (5.2 kB)
Collecting murmurhash<0.29.0,>=0.28.0
  Downloading murmurhash-0.28.0.tar.gz (23 kB)
  Preparing metadata (setup.py) ... done
Collecting cymem<1.32.0,>=1.30.0
  Downloading cymem-1.31.2.tar.gz (33 kB)
  Preparing metadata (setup.py) ... done
Collecting preshed<2.0.0,>=1.0.0
  Downloading preshed-1.0.1.tar.gz (112 kB)
     ---------------------------------------- 112.7/112.7 kB 6.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting cytoolz<0.10,>=0.9.0
  Downloading cytoolz-0.9.0.1.tar.gz (443 kB)
     ---------------------------------------- 443.4/443.4 kB 3.9 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting wrapt<1.11.0,>=1.10.0
  Downloading wrapt-1.10.11.tar.gz (27 kB)
  Preparing metadata (setup.py) ... done
Collecting plac<1.0.0,>=0.9.6
  Downloading plac-0.9.6-py2.py3-none-any.whl (20 kB)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in python\python310\lib\site-packages (from thinc[cuda10]==6.10.4.dev0) (4.64.0)
Requirement already satisfied: six<2.0.0,>=1.10.0 in python\python310\lib\site-packages (from thinc[cuda10]==6.10.4.dev0) (1.16.0)
Collecting dill<0.3.0,>=0.2.7
  Downloading dill-0.2.9.tar.gz (150 kB)
     ---------------------------------------- 150.7/150.7 kB 4.4 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting thinc_gpu_ops<0.1.0,>=0.0.2
  Downloading thinc_gpu_ops-0.0.4.tar.gz (483 kB)
     ---------------------------------------- 483.5/483.5 kB 3.0 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement cupy-cuda10>=5.0.0b4 (from thinc[cuda10]) (from versions: none)
ERROR: No matching distribution found for cupy-cuda10>=5.0.0b4

It happens because there is missed requirement in setup.py file:

...
            extras_require={
                'cuda': ['thinc_gpu_ops>=0.0.2,<0.1.0', 'cupy>=5.0.0b4'],
                'cuda80': ['thinc_gpu_ops>=0.0.2,<0.1.0', 'cupy-cuda80>=5.0.0b4'],
                'cuda90': ['thinc_gpu_ops>=0.0.2,<0.1.0', 'cupy-cuda90>=5.0.0b4'],
                'cthiuda91': ['thinc_gpu_ops>=0.0.2,<0.1.0', 'cupy-cuda91>=5.0.0b4'],
                'cuda92': ['thinc_gpu_ops>=0.0.2,<0.1.0', 'cupy-cuda92>=5.0.0b4'],
                'cuda10': ['thinc_gpu_ops>=0.0.2,<0.1.0', 'cupy-cuda10>=5.0.0b4'],
            },
...

It's dangerous because the intruder can create malicious package "cupy-cuda10" on pypi and:

  • Make online guides how to use your package and abuse this malicious supply chain attack to compromise users.
  • Infect automated CI/CD pipelines that uses old version of your package
  • Infect other users by hardcoding those versions of package in opensource projects that use it

It's dangerous because usage of thinc, even outdated, is not something strange. Everyone likes hardcoded versions of packages, even in the era of protestware.

The best solution is to delete thinc 6.10.4.dev0 from pypi. Better to break dependencies in some old pipelines than compromise them. Furthermore this is a pre-release version of your package.

Rakovsky Stanislav (Positive Technologies)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant