public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Luke Dashjr <luke@dashjr•org>
To: bitcoin-dev@lists•linuxfoundation.org
Cc: security@bitcoincore•org
Subject: [bitcoin-dev] CVE-2018-20586 disclosure (log injection vulnerability)
Date: Fri, 22 Nov 2019 17:13:14 +0000	[thread overview]
Message-ID: <201911221713.14678.luke@dashjr.org> (raw)

CVE-2018-20586 is a log injection vulnerability which allows any software with 
access to the RPC port to create fake or confusing entries in the debug log. 
Valid authentication (username/password/cookie) for the RPC service is NOT 
required to exploit this vulnerability, only the ability to connect to the 
RPC port (which is by default only exposed to the local machine).

The vulnerability was introduced in 40b556d3742a1f65d67e2d4c760d0b13fe8be5b7 
("libevent-based http server") and first released in Bitcoin Core v0.12.0rc1 
in 2016 Jan 13. A fix was hidden in 79358817e53ac0a7afa64c747115d492a74e3155 
("rpc: Make HTTP RPC debug logging more informative") released in v0.17.1, 
2018 Dec 22.

To be vulnerable, the malicious software must either be running on the same 
machine as the node, have the ability to proxy connections to the node via 
the local machine, or the node must be configured to accept RPC connections 
from a network via which the attacker can connect. Additionally, a human user 
must read the debug log and act on or otherwise believe the injected data, in 
a way that is somehow harmful.

Because the node would log the arbitrary POST request from any connection, an 
attacker can add nearly any content to the request to inject it into the log. 
To ensure their entire request is injected, standard spaces would need to be 
replaced with alternative whitespace characters, and newlines would need to 
become other control characters (such as "\r\v"). Because the injected data 
must use such non-standard characters, it is most likely to not fool other 
software parsing the debug log, and only a human visually reading it.

To fix this vulnerability, POST requests are now sanitised before being 
logged, removing all characters that shouldn't be in an ordinary POST 
request.

Credit goes to practicalswift (https://twitter.com/practicalswift) for 
discovering and fixing the vulnerability.

Timeline:
- 2015-01-18: Vulnerability introduced in PR #5677.
- 2015-09-04: Vulnerability merged to master git repository.
- 2016-01-13: Vulnerability published in v0.12.0rc1.
- 2016-02-18: Vulnerability released in v0.12.0.
...
- 2018-10-25: practicalswift discloses vulnerability to security team.
- 2018-10-31: practicalswift opens PR #14618 to quietly fix vulnerability.
- 2018-11-05: Fix merged to master git repository.
- 2018-11-30: Fix merged to 0.17 git repository.
- 2018-12-07: Fix published in v0.17.1rc1.
- 2018-12-22: Fix released in v0.17.1.
...
- 2019-06-22: Vulnerability existence disclosed to bitcoin-dev ML.
- 2019-11-22: Vulnerability details disclosure to bitcoin-dev ML.


                 reply	other threads:[~2019-11-22 17:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201911221713.14678.luke@dashjr.org \
    --to=luke@dashjr$(echo .)org \
    --cc=bitcoin-dev@lists$(echo .)linuxfoundation.org \
    --cc=security@bitcoincore$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox