Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 484806 (CVE-2013-4346, CVE-2013-4347) - <dev-python/oauth2-1.9.0_p1: two vulnerabilities (CVE-2013-{4346,4347})
Summary: <dev-python/oauth2-1.9.0_p1: two vulnerabilities (CVE-2013-{4346,4347})
Status: RESOLVED FIXED
Alias: CVE-2013-4346, CVE-2013-4347
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL: http://www.openwall.com/lists/oss-sec...
Whiteboard: B3 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-13 18:55 UTC by Agostino Sarubbo
Modified: 2016-11-26 00:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2013-09-13 18:55:32 UTC
From ${URL} :

- _check_signature() ignores the nonce value when validating signed urls

    def _check_signature(self, request, consumer, token):
        timestamp, nonce = request._get_timestamp_nonce()
        self._check_timestamp(timestamp)
        signature_method = self._get_signature_method(request)

        try:
            signature = request.get_parameter('oauth_signature')
        except:
            raise MissingSignature('Missing oauth_signature.')

        # Validate the signature.
        valid = signature_method.check(request, consumer, token, signature)

        if not valid:
            key, base = signature_method.signing_base(request, consumer, token)

            raise Error('Invalid signature. Expected signature base '
                'string: %s' % base)

Ignoring the nonce value enables replay attacks.

This appears to already be known (ignoring the misleading title):
https://github.com/simplegeo/python-oauth2/issues/129

- _check_timestamp() does not constrain how far into the future times may be,
  (also does not prevent negative times, but probably not relevant for a CVE)

    def _check_timestamp(self, timestamp):
        """Verify that timestamp is recentish."""
        timestamp = int(timestamp)
        now = int(time.time())
        lapsed = now - timestamp
        if lapsed > self.timestamp_threshold:
            raise Error('Expired timestamp: given %d and now %s has a '
                'greater difference than threshold %d' % (timestamp, now,
                    self.timestamp_threshold))

The timestamps are probably most useful to limit the number of nonces
that must be stored and compared but it seems generally useful to prevent
timestamps from the distant future from being allowed.


- make_nonce(), generate_nonce(), and generate_verifier() use a poor prng:

    @classmethod
    def make_nonce(cls):
        """Generate pseudorandom number."""
        return str(random.randint(0, 100000000))


    def generate_nonce(length=8):
        """Generate pseudorandom number."""
        return ''.join([str(random.randint(0, 9)) for i in range(length)])
    
    
    def generate_verifier(length=8):
        """Generate pseudorandom number."""
        return ''.join([str(random.randint(0, 9)) for i in range(length)])

Nonces may not need full-blown /dev/urandom but the Python 'random'
documentation clearly states the results are repeatable. The lack of
seeding in this module makes me think this is too weak for this use.

The safety of oauth depends upon the verifier being unguessable, and
this is both too short, with too few character choices, and probably
does need full-blown /dev/urandom style randomness.

The poor PRNG for the nonce has been known since 2010-04-24 (silly github, 
hover your _mouse pointer_ over the "3 years ago" text in the bug report):
https://github.com/simplegeo/python-oauth2/issues/9



@maintainer(s): after the bump, in case we need to stabilize the package, please say explicitly if it is ready for the stabilization or not.
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2015-08-16 11:03:06 UTC
(In reply to Manuel Rüger from comment #1)
> Upstream claims to have this fixed.
> https://github.com/joestump/python-oauth2/issues/129#issuecomment-125934274 
> 
> 
> https://github.com/joestump/python-oauth2/commit/
> 82dd2cdd4954cd7b8983d5d64c0dfd9072bf4650

I only see CVE-2013-4346 referenced. Please clarify if 4347 is also fixed.
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2016-11-22 15:45:58 UTC
CVE-2013-4347 was fixed via https://github.com/joestump/python-oauth2/commit/82dd2cdd4954cd7b8983d5d64c0dfd9072bf4650 which was first released as part of v1.9 by upstream.


@ Arches,

please test and mark stable: =dev-python/oauth2-1.9.0_p1
Comment 4 Agostino Sarubbo gentoo-dev 2016-11-25 18:28:07 UTC
amd64 stable
Comment 5 Agostino Sarubbo gentoo-dev 2016-11-25 18:54:56 UTC
x86 stable.

Maintainer(s), please cleanup.
Security, please vote.
Comment 6 Aaron Bauman (RETIRED) gentoo-dev 2016-11-26 00:08:05 UTC
GLSA Vote: No