Bug 1348469

Summary: Arbitrary code execution due to insecure loading of Python module(s) from CWD
Product: [Fedora] Fedora Reporter: Dhiru Kholia <dkholia>
Component: imgbasedAssignee: Yuval Turgeman <yturgema>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 27CC: fabian.deutsch, fdeutsch, yturgema
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-25 08:12:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1348410    

Description Dhiru Kholia 2016-06-21 09:01:17 UTC
The /usr/sbin/imgbase script from the imgbased package tries to load the "imgbased" Python module from the current working directory (CWD).

Steps to Reproduce:

$ cat > imgbased.py
print("boom!")

$ imgbase  # run /usr/sbin/imgbase
boom!
...

Additional info:

This bug is very similar to https://bugzilla.redhat.com/show_bug.cgi?id=995060

Comment 1 Fabian Deutsch 2016-06-21 12:27:11 UTC
Thanks - We should just search the local dir in the development environemnt, and use the abs path in production.

Comment 2 Fedora End Of Life 2017-07-25 21:09:04 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Sandro Bonazzola 2017-07-26 06:12:34 UTC
Yuval, can you check if this is still an issue?

Comment 4 Yuval Turgeman 2017-07-26 07:00:51 UTC
Not exactly, but I can create something similar:
[root@localhost ~]# mkdir -p src/imgbased
[root@localhost ~]# touch src/imgbased/__init__.py
[root@localhost ~]# cat > src/imgbased/__main__.py
print("boom")
[root@localhost ~]# imgbase
Enabling in-tree mode (python)
boom

Comment 5 Sandro Bonazzola 2017-07-26 07:30:35 UTC
Let's fix this.

Comment 6 Dhiru Kholia 2017-07-26 09:06:46 UTC
Thanks for looking at this, and writing the new reproducer!

Comment 7 Jan Kurik 2017-08-15 06:34:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.