Bug 1140711 (CVE-2019-18905) - VUL-1: CVE-2019-18905: autoyast2: insecure use of --gpg-auto-import-keys?
Summary: VUL-1: CVE-2019-18905: autoyast2: insecure use of --gpg-auto-import-keys?
Status: RESOLVED FIXED
Alias: CVE-2019-18905
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: YaST Team
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/236645/
Whiteboard: CVSSv3.1:SUSE:CVE-2019-18905:5.3:(AV:...
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-08 11:49 UTC by Matthias Gerstner
Modified: 2024-04-17 12:57 UTC (History)
11 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
AutoYaST: Installation from images (46.68 KB, image/png)
2020-03-09 11:10 UTC, Lukas Ocilka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Gerstner 2019-07-08 11:49:48 UTC
This is somewhat related to bug 821267. We noticed that autoyast2 passes the
`--gpg-auto-import-keys` option to zypper unconditionally in
src/modules/AutoinstSoftware.rb createImage(). This means that any untrusted
repository keys encountered by zypper will be accepted.

Depending on the `media_url` used (in case of http) this may allow a man in
the middle to serve more or less arbitrary repositories signed with their own
PGP keys.

The original use case for this feature seems to have been to allow unattended
installations where some custom repositories are involved (fate#307087). We
think the proper way to do that would be to specify the additionally trusted
repository keys (their IDs and fingerprints) in the autoyast XML configuration
and only trust them explicitly during installation.
Comment 2 Stefan Schubert 2019-07-24 09:33:14 UTC
As far I see these calls will be used in the AutoYaST configuration module only. (Not during an installation). It is around handling/installing/creating Images which speed ups installation. I have tried to run it but without success. 
It is a quite old undocumented feature. I have only found an example:
 <software>
    <image>
      <image_location>http://taylor/</image_location>
      <image_name>uwe</image_name>
      <script_location>file:///tmp/fetch_image.sh</script_location>
      <script_params config:type="list">
        <listentry>http://taylor//uwe.tar.gz</listentry>
      </script_params>
      <run_kickoff config:type="boolean">true</run_kickoff>
    </image>
    <instsource>http://taylor/11.2_install_i586/DVD1/</instsource>
    <patterns config:type="list">
      <pattern>apparmor_opt</pattern>
      <pattern>base</pattern>
      <pattern>yast2_install_wf</pattern>
      <pattern>sw_management</pattern>
      <pattern>apparmor</pattern>
    </patterns>
    <packages config:type="list">
      <package>kernel-default</package>
    </packages>
  </software>

and a funny string:

"Here you can choose to use Novell pre-defined images to speed up RPM installation."

I have doubts that this feature has been used by any user in the last 5 years because it is undocumented and at least for me not really understandable. 
Lukas, do you have more information about it ? For me it is a candidate for dropping it.
Comment 3 Lukas Ocilka 2019-07-24 12:33:48 UTC
(In reply to Matthias Gerstner from comment #0)
> We
> think the proper way to do that would be to specify the additionally trusted
> repository keys (their IDs and fingerprints) in the autoyast XML
> configuration
> and only trust them explicitly during installation.

That would be IMO a feature request

(In reply to Stefan Schubert from comment #2)
> I have doubts that this feature has been used by any user in the last 5
> years because it is undocumented and at least for me not really
> understandable. 
> Lukas, do you have more information about it ? For me it is a candidate for
> dropping it.

I don't have any more information about it either.
I've never seen anyone using it (well, reporting a bug, requesting an
enhancement, etc.).
And it's undocumented, so really a candidate to kill.
Comment 4 Matthias Gerstner 2019-07-29 11:18:23 UTC
(In reply to locilka@suse.com from comment #3)
> (In reply to Matthias Gerstner from comment #0)
> > We
> > think the proper way to do that would be to specify the additionally trusted
> > repository keys (their IDs and fingerprints) in the autoyast XML
> > configuration
> > and only trust them explicitly during installation.
> 
> That would be IMO a feature request

Well security is not especially keen to have that feature, we'd just like to
have things safe, that said ...

> I don't have any more information about it either.
> I've never seen anyone using it (well, reporting a bug, requesting an
> enhancement, etc.).
> And it's undocumented, so really a candidate to kill.

... killing it would even be safer :-)
Comment 5 Stefan Schubert 2019-08-09 14:31:54 UTC
Added to our Trello board
Comment 6 Alexander Bergmann 2019-12-04 15:44:40 UTC
@Stefan, what's the status here? We have an autoyast2 update in the pipeline and would like to fix this as well.
Comment 7 Lukas Ocilka 2019-12-05 09:22:06 UTC
(In reply to Alexander Bergmann from comment #6)
> @Stefan, what's the status here? We have an autoyast2 update in the pipeline
> and would like to fix this as well.

We haven't planned for this yet. It's just a P3 BTW. IMO, dropping the
feature should be done in new products only and well tested.

It's a feature that
- is undocumented
- nobody uses
- creates images that are no longer used anyway (AFAIK)

So, looks like a dead code. Is there any real need for removing that code
now? Or is that just because you have another AY patch to be released soon?

PS: We plan AY refactoring, such code-drop could be part of it.
Comment 8 Matthias Gerstner 2019-12-05 10:02:46 UTC
(In reply to locilka@suse.com from comment #7)
> We haven't planned for this yet. It's just a P3 BTW. IMO, dropping the
> feature should be done in new products only and well tested.
> 
> It's a feature that
> - is undocumented
> - nobody uses
> - creates images that are no longer used anyway (AFAIK)
> 
> So, looks like a dead code. Is there any real need for removing that code
> now? Or is that just because you have another AY patch to be released soon?

This sounds a bit contradictory. It's dead code but removing it should be well
tested? So AutoinstSoftwareClass.createImage() is dead code?

To solve this bug from a security perspective all that would need to be done
is removing those three occurences of `--gpg-auto-import-keys` and if you
think it's not used anyways then this should be very low risk.

Zypper and the repository infrastructure are at the core of the distribution
security and having code around that auto import's GPG keys should not be
taken lightly, be it supposedly dead, or not.
Comment 10 Lukas Ocilka 2020-03-04 20:48:39 UTC
Comment #7 still applies.
P3 == Basically no chance to get changed. I'm sorry.

I've added this to the planned AutoYaST refactoring/cleanup task.
Planned for ~SLE 15 SP3
Comment 11 Johannes Segitz 2020-03-09 10:51:08 UTC
We'll use CVE-2019-18905 to track this. CRD is 2020-06-08 as per our policy, but from our POV we can make it public right away, since we will not try to get this fixed in old products and are fine with it being removed in 15.3

Standard disclaimer:
This issue will be handled according to our disclosure policy outlined in
https://en.opensuse.org/openSUSE:Security_disclosure_policy

The information listed here is not public. Please
- do not talk to other people about this unless they're involved in fixing the issue
- do not make this bug public

In accordance with our policy we will make this issue public latest at
Internal CRD: 2020-06-08 or earlier
This is the latest possible date and we prefer to make it public earlier if the
situation allows it. In that case we'll post a comment here setting the new
date.

Only a member of the security team is allowed to make this issue public. Please speak to us if you want to take part in  the public disclosure.

In doubt please talk to us on IRC (#security) or send us a mail (security@suse.de).
Comment 12 Lukas Ocilka 2020-03-09 11:10:36 UTC
Created attachment 832246 [details]
AutoYaST: Installation from images

Here's where you can see it "in action".
The screenshot comes from 15.1 and it's behavior is actually broken,
radio-buttons do not work as expected. In fact, the feature can't be
used at all. No reports about that so far.
Comment 13 Lukas Ocilka 2020-03-09 11:21:26 UTC
Alexander, the AutoYaST configuration (on a running system) offers
functionality that pretends to allow for creating pre-configured images
for "installation from images". This feature does not work in UI and
Security Team has found a potential security issue (if the UI actually worked)
in the code.

What should we do and in which SPs? E.g., we still have time to remove this
from SLE 15 SP2, especially as there are no images created by SUSE and the UI
for creating images is broken anyway (looks like last change was in 2016).
Comment 14 Alexander Herzig 2020-03-09 13:50:26 UTC
Hi Lukas,
I would like to see this being addressed in 15SP2. Although it is 'dead code' I understand it is still a valid vulnerability as per comment #7 of Matthias.

If 'removing those three occurrences of `--gpg-auto-import-keys`  is sufficient for security', we should do this for SP2. 
Please also look into 15:GA and 15SP1.

A proper refactoring for SP3 can then be done.
Comment 15 Lukas Ocilka 2020-03-09 14:30:40 UTC
OK, I'll ask to team to remove those calls.

SLE 15 SP3 should IMO remove the whole image creation UI.
It's too late for SP2 now.
Comment 25 Swamp Workflow Management 2020-05-22 22:30:40 UTC
openSUSE-SU-2020:0676-1: An update that solves one vulnerability and has 6 fixes is now available.

Category: security (moderate)
Bug References: 1109310,1133045,1140711,1164105,1168123,1168281,1170082
CVE References: CVE-2019-18905
Sources used:
openSUSE Leap 15.1 (src):    autoyast2-4.1.15-lp151.2.12.1
Comment 32 Stefan Hundhammer 2024-04-17 12:57:26 UTC
Fixed according to comment #16 .. comment #31.