Skip to content

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented May 9, 2019

@DrahtBot
Copy link
Contributor

DrahtBot commented May 9, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@laanwj
Copy link
Member

laanwj commented May 9, 2019

Concept ACK, we definitely don't want to support miniUPnPc versions that are insecure

@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from 67b1263 to f8a381e Compare May 10, 2019 14:36
@maflcko maflcko removed the Tests label May 10, 2019
src/net.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 10?

Everything below (and including 14) is broken: #6789

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 10?

This is API version for xenial and jessy libminiupnpc-dev.

Everything below (and including 14) is broken: #6789

You are right. This PR is a kind of trade-off. Otherwise, a user should be forced to build libminiupnpc-dev by himself.

Anyway, I'll appreciate any smart solution for this security issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should support building against known broken versions. If someone really needs to build against such an old version, they could update the code themselves (remove the assert) or build a newer version of miniupnpc (which conveniently is shipped in our ./depends)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot find a suitable assertion to let only build with CVE-2017-8798 fix commit (see: #10414):

  • MINIUPNPC_API_VERSION >= 17 is too narrow (see: miniupnpc-2.1 changelog)
  • MINIUPNPC_API_VERSION >= 16 is too wide: versions before miniupnpc-2.0.20170509 are included

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINIUPNPC_API_VERSION >= 16 should be fine. The code might be removed soon anyway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should ideally drop support for all vulnerable versions.

@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from f8a381e to fe94f27 Compare May 11, 2019 00:34
@hebasto hebasto changed the title net: Drop the ancient miniUPnPc API version support net: Drop support of the insecure miniUPnPc versions May 11, 2019
@hebasto
Copy link
Member Author

hebasto commented May 11, 2019

@MarcoFalke
Thank you for your review. Your comments have been addressed.
PR title and description are updated.

@practicalswift
Copy link
Contributor

Concept ACK

We should now allow dependencies with known flaws.

@maflcko
Copy link
Member

maflcko commented May 13, 2019

utACK fe94f276faa6f5905132d9062469432347bce747

Only checked that this is removing code and adding the static assert
Didn't compile to see if the PACKAGE_NAME makes it through

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

utACK fe94f276faa6f5905132d9062469432347bce747

Only checked that this is removing code and adding the static assert
Didn't compile to see if the PACKAGE_NAME makes it through
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUg4oQv/e3VkOJrARmameKhDCpGtwE/QvZrIGYlSFEqOm0LNHLgMfLg+Siy3hCy4
Vbw/RX/scVghRtDk/oFMQvQaNHFTYe+6cWL95yBT9LvIrfhga/NKxk2ydEXO1BT2
7VgmK7XMMY16BbMiYUk6XrgDe9xepXP/PZsg0qquhnwA0bANOjwROPVi6bEfHgkF
kTPM+c0VEHXp9iPdQ8/aIQfMjktQGT1p3Yy+Q93oQzh/TPukBgVCJVLYssVzUCQL
q5aqCYX+L0dazMKk+CV4564vNOQ5wt2fna3TLogp/VYYdS3C3TVuj+AuZYmTiXgS
wd9KOLEyIPK4Yx+Iv3JnBU1jNs0i420iV5IO2EBIMLbFv7Uy2fp9BAubLoZRUeTX
FK9k4kbkEVdgCw0MGRkQulQTG746tZCnCgGKtaZLrj+tNR9BTTEH/x1qMmOZs060
CH9X5sJP4fE5ZYXCgd3DHzK3KvvFqdxlVbdbFUWyW1vki/Kgr90AWOijH3moSUMc
PgWMPjzU
=dAQ4
-----END PGP SIGNATURE-----

Timestamp of file with hash e55601d854a120567f2935cc7fb439ec8290e1fb985aa3a871fd0ce1c62777ba -

@practicalswift
Copy link
Contributor

utACK fe94f276faa6f5905132d9062469432347bce747

@gmaxwell
Copy link
Contributor

If this requires >= 16 it eliminates miniupnp versions that debian is still using (but with fixes), no?

@laanwj
Copy link
Member

laanwj commented May 16, 2019

If this requires >= 16 it eliminates miniupnp versions that debian is still using (but with fixes), no?

yes

stretch (stable) (net): UPnP IGD client lightweight library client
1.9.20140610-4: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390x 

which defines:

./miniupnpc.h:#define MINIUPNPC_API_VERSION	10

@gmaxwell
Copy link
Contributor

This should be changed to 10 then, the (bulk of the?) API changes are compatible with 10-- and there are patched systems that return 10. I don't think we have any strong reason to gratuitously break compatibility beyond that.

@hebasto
Copy link
Member Author

hebasto commented May 17, 2019

This PR is becoming a bit controversial:

#15993 (comment), #15993 (comment) by @MarcoFalke:

Why 10?
Everything below (and including 14) is broken: #6789
MINIUPNPC_API_VERSION >= 16 should be fine. The code might be removed soon anyway

#15993 (comment) by @gmaxwell:

This should be changed to 10 then, the (bulk of the?) API changes are compatible with 10-- and there are patched systems that return 10. I don't think we have any strong reason to gratuitously break compatibility beyond that.

Can we reach the consensus? Or should this PR be closed for now?

@maflcko
Copy link
Member

maflcko commented May 17, 2019

Yeah, isn't this superseded by Changes to support NAT-PMP #15717

@laanwj
Copy link
Member

laanwj commented May 20, 2019

Can we reach the consensus? Or should this PR be closed for now?

Just change it to 10 and it's OK imo. Dropping support for other versions can be done later but only when it's gone from debian stable.

@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from fe94f27 to 12a0de5 Compare May 21, 2019 05:01
@hebasto
Copy link
Member Author

hebasto commented May 21, 2019

@gmaxwell

This should be changed to 10 then, the (bulk of the?) API changes are compatible with 10-- and there are patched systems that return 10. I don't think we have any strong reason to gratuitously break compatibility beyond that.

@laanwj

Just change it to 10 and it's OK imo. Dropping support for other versions can be done later but only when it's gone from debian stable.

@gmaxwell, @laanwj
Thank you for your reviews.
Minimum API reverted to 10. The PR description has been reverted to the initial state as well.

@laanwj
Copy link
Member

laanwj commented May 21, 2019

LGTM now, utACK 12a0de5931fcbbad388e56447e297e38ff54bfcf

@hebasto
Copy link
Member Author

hebasto commented May 21, 2019

Release notes have been added.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't they patched? Otherwise we would set the API version higher, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't they patched?

The libminiupnpc10 package has been patched on Ubuntu only:

On Debian:

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, but this needs to update configure to reject incompatible versions. (Ideally rejecting vulnerable versions even if they are API-compatible with the code.)

@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch 3 times, most recently from 71919be to ef43e37 Compare May 22, 2019 16:27
@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from ef43e37 to 3942fca Compare June 6, 2019 20:40
@hebasto
Copy link
Member Author

hebasto commented Jun 6, 2019

@luke-jr @laanwj

Concept ACK, but this needs to update configure to reject incompatible versions. (Ideally rejecting vulnerable versions even if they are API-compatible with the code.)

Are you going to do that here @hebasto ?

Done.

@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from 3942fca to 5993b87 Compare June 6, 2019 20:58
configure.ac Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recommend referring to GitHub issues. I think we're supposed to have a self-contained [set of] git repo(s)?

configure.ac Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--with-miniupnpc=auto (ie, the default) won't work with this check.

Just set have_miniupnpc=no here instead (and change this to AC_MSG_WARNING).

@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from 5993b87 to ded2de5 Compare June 7, 2019 07:51
@hebasto
Copy link
Member Author

hebasto commented Jun 7, 2019

@luke-jr
Thank you for your review. All your comments have been addressed.

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK, with a few nits

configure.ac Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some API v10 is also vulnerable, right? I think we just want to say "unsupported" here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

src/net.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the version comments?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are irrelevant now. See: miniupnpc/apiversions.txt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how they are irrelevant...

Copy link
Member Author

@hebasto hebasto Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to version 1.7, there was no MINIUPNPC API_VERSION macro. Therefore, different ways were used to distinguish between different versions. Comments were needed to make those "hacks" obvious.
Nowadays, the difference in the upnpDiscover() function signature is clear stated in different API versions.

Particularly,

API version 14
miniupnpc.h
  add ttl argument to upnpDiscover() upnpDiscoverAll() upnpDiscoverDevice()
...
  updated macro :
    #define MINIUPNPC_API_VERSION 14

src/net.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should ideally drop support for all vulnerable versions.

@laanwj
Copy link
Member

laanwj commented Jun 13, 2019

I think this is dragging on way too long, and maybe getting out of hand, getting round after round of nits for essentially removing a few #ifdefed lines that were probably never getting compiled in the first place.

Please, let's try to move forward and merge this to have this off our radar.

Also fixes behavior when libminiupnpc is not installed.
@hebasto hebasto force-pushed the 20190506-drop-ancient-miniupnpc-api branch from ded2de5 to 59cb722 Compare June 13, 2019 20:53
@hebasto
Copy link
Member Author

hebasto commented Jun 13, 2019

"vulnerable" replaced with "unsupported" as @luke-jr suggested.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 59cb722. Changes since last review: adding a new commit which updates configure script to fall back to disabling upnp if version is too old, adding a requested comment explaining static_assert condition, and fixing a spelling (jessy/jessie)

@laanwj laanwj merged commit 59cb722 into bitcoin:master Jul 29, 2019
laanwj added a commit that referenced this pull request Jul 29, 2019
59cb722 Update configure to reject unsafe miniUPnPc API ver (Hennadii Stepanov)
ab21905 doc: Add release notes for 15993 (Hennadii Stepanov)
02709e9 Align formatting with clang-format (Hennadii Stepanov)
91a1b85 Use PACKAGE_NAME in UPnP description (Hennadii Stepanov)
9f76e45 Drop support of insecure miniUPnPc versions (Hennadii Stepanov)

Pull request description:

  1. Minimum supported miniUPnPc API version is set to 10:
  - https://packages.ubuntu.com/xenial/libminiupnpc-dev
  - https://packages.debian.org/jessie/libminiupnpc-dev

  Refs:
  - #6583
  - #6789
  - #10414

  2. The hardcoded "Bitcoin" replaced with `PACKAGE_NAME`:
  ![Screenshot from 2019-05-06 23-10-29](https://user-images.githubusercontent.com/32963518/57253178-afc60780-7056-11e9-83c9-e85670c58c1e.png)

  3. Also style-only commit applied.

  Pardon: could not reopen my previous PR #15966.

ACKs for top commit:
  ryanofsky:
    utACK 59cb722. Changes since last review: adding a new commit which updates configure script to fall back to disabling upnp if version is too old, adding a requested comment explaining static_assert condition, and fixing a spelling (jessy/jessie)

Tree-SHA512: 42ed11bc2fb2ec83d5dd58e2383da5444a24fd572707f6cf10b622cb8943e28adfcca4750d06801024c4472625b5ea9279516fbd9d2ccebc9bbaafe1d148e80d
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 30, 2019
…ions

59cb722 Update configure to reject unsafe miniUPnPc API ver (Hennadii Stepanov)
ab21905 doc: Add release notes for 15993 (Hennadii Stepanov)
02709e9 Align formatting with clang-format (Hennadii Stepanov)
91a1b85 Use PACKAGE_NAME in UPnP description (Hennadii Stepanov)
9f76e45 Drop support of insecure miniUPnPc versions (Hennadii Stepanov)

Pull request description:

  1. Minimum supported miniUPnPc API version is set to 10:
  - https://packages.ubuntu.com/xenial/libminiupnpc-dev
  - https://packages.debian.org/jessie/libminiupnpc-dev

  Refs:
  - bitcoin#6583
  - bitcoin#6789
  - bitcoin#10414

  2. The hardcoded "Bitcoin" replaced with `PACKAGE_NAME`:
  ![Screenshot from 2019-05-06 23-10-29](https://user-images.githubusercontent.com/32963518/57253178-afc60780-7056-11e9-83c9-e85670c58c1e.png)

  3. Also style-only commit applied.

  Pardon: could not reopen my previous PR bitcoin#15966.

ACKs for top commit:
  ryanofsky:
    utACK 59cb722. Changes since last review: adding a new commit which updates configure script to fall back to disabling upnp if version is too old, adding a requested comment explaining static_assert condition, and fixing a spelling (jessy/jessie)

Tree-SHA512: 42ed11bc2fb2ec83d5dd58e2383da5444a24fd572707f6cf10b622cb8943e28adfcca4750d06801024c4472625b5ea9279516fbd9d2ccebc9bbaafe1d148e80d
@hebasto hebasto deleted the 20190506-drop-ancient-miniupnpc-api branch July 31, 2019 14:41
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 3, 2020
Summary:
The minimum supported miniUPnPc API version is set to 10 (debian 8 and ubuntu 16.04)

This is a backport of Core [[bitcoin/bitcoin#15993 | PR15993]]

Included commits:
 - [[bitcoin/bitcoin@9f76e45 | 9f76e45 Drop support of insecure miniUPnPc versions]]
 - [[bitcoin/bitcoin@91a1b85 | 91a1b85 Use PACKAGE_NAME in UPnP description]]
 - [[bitcoin/bitcoin@ab21905 | ab21905 Add release notes]]

Test Plan: `ninja all check-all`

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8211
furszy added a commit to PIVX-Project/PIVX that referenced this pull request May 8, 2021
60cd984 doc: Add release notes about minimum required miniupnpc API version (Fuzzbawls)
d9a2024 CMake: Require miniupnpc API version 10 or greater (Fuzzbawls)
d0ed7d2 Update configure to reject unsafe miniUPnPc API ver (Hennadii Stepanov)
bd0ed0c Align formatting with clang-format (Fuzzbawls)
f43781f Use PACKAGE_NAME in UPnP description (Fuzzbawls)
f2e1e09 Drop support of insecure miniUPnPc versions (Fuzzbawls)

Pull request description:

  Backport of bitcoin#15993

  This results in a rejection of older versions of miniupnpc for both autotools and CMake build systems. API Version 10 was used to maintain compatibility with Ubuntu Xenial (which uses a patched version of miniupnpc but still reports API version 10) and Debian 8 (which is not fully patched).

  Miniupnp support as a whole remains disabled by default

ACKs for top commit:
  furszy:
    utACK 60cd984
  random-zebra:
    utACK 60cd984
  random-zebra:
    utACK 60cd984

Tree-SHA512: b3294c3474797226b5d154cc961efc1209fde58c6af70a1a292fcd3bc18de712ab3bcc6e1de6f6ba67ccf5ca9c8db90a116a4c43fbfd12b42d622b17523585df
barton2526 added a commit to barton2526/Gridcoin-Research that referenced this pull request Jun 12, 2021
Minimum supported miniUPnPc API version is set to 10.  This prevents numerous security issues by enforcing a 2015 UPnP version (keeps compatibility with Ubuntu 16.04 LTS and Debian 8)

Ref: bitcoin/bitcoin#15993
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 26, 2021
…ions

59cb722 Update configure to reject unsafe miniUPnPc API ver (Hennadii Stepanov)
ab21905 doc: Add release notes for 15993 (Hennadii Stepanov)
02709e9 Align formatting with clang-format (Hennadii Stepanov)
91a1b85 Use PACKAGE_NAME in UPnP description (Hennadii Stepanov)
9f76e45 Drop support of insecure miniUPnPc versions (Hennadii Stepanov)

Pull request description:

  1. Minimum supported miniUPnPc API version is set to 10:
  - https://packages.ubuntu.com/xenial/libminiupnpc-dev
  - https://packages.debian.org/jessie/libminiupnpc-dev

  Refs:
  - dashpay#6583
  - dashpay#6789
  - bitcoin#10414

  2. The hardcoded "Bitcoin" replaced with `PACKAGE_NAME`:
  ![Screenshot from 2019-05-06 23-10-29](https://user-images.githubusercontent.com/32963518/57253178-afc60780-7056-11e9-83c9-e85670c58c1e.png)

  3. Also style-only commit applied.

  Pardon: could not reopen my previous PR bitcoin#15966.

ACKs for top commit:
  ryanofsky:
    utACK 59cb722. Changes since last review: adding a new commit which updates configure script to fall back to disabling upnp if version is too old, adding a requested comment explaining static_assert condition, and fixing a spelling (jessy/jessie)

Tree-SHA512: 42ed11bc2fb2ec83d5dd58e2383da5444a24fd572707f6cf10b622cb8943e28adfcca4750d06801024c4472625b5ea9279516fbd9d2ccebc9bbaafe1d148e80d
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 26, 2021
…ions

59cb722 Update configure to reject unsafe miniUPnPc API ver (Hennadii Stepanov)
ab21905 doc: Add release notes for 15993 (Hennadii Stepanov)
02709e9 Align formatting with clang-format (Hennadii Stepanov)
91a1b85 Use PACKAGE_NAME in UPnP description (Hennadii Stepanov)
9f76e45 Drop support of insecure miniUPnPc versions (Hennadii Stepanov)

Pull request description:

  1. Minimum supported miniUPnPc API version is set to 10:
  - https://packages.ubuntu.com/xenial/libminiupnpc-dev
  - https://packages.debian.org/jessie/libminiupnpc-dev

  Refs:
  - dashpay#6583
  - dashpay#6789
  - bitcoin#10414

  2. The hardcoded "Bitcoin" replaced with `PACKAGE_NAME`:
  ![Screenshot from 2019-05-06 23-10-29](https://user-images.githubusercontent.com/32963518/57253178-afc60780-7056-11e9-83c9-e85670c58c1e.png)

  3. Also style-only commit applied.

  Pardon: could not reopen my previous PR bitcoin#15966.

ACKs for top commit:
  ryanofsky:
    utACK 59cb722. Changes since last review: adding a new commit which updates configure script to fall back to disabling upnp if version is too old, adding a requested comment explaining static_assert condition, and fixing a spelling (jessy/jessie)

Tree-SHA512: 42ed11bc2fb2ec83d5dd58e2383da5444a24fd572707f6cf10b622cb8943e28adfcca4750d06801024c4472625b5ea9279516fbd9d2ccebc9bbaafe1d148e80d
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants