CVE-2017-13083 (C, published 2017-10-18T13:29Z)
Description: value: Akeo Consulting Rufus prior to version 2.17.1187 does not adequately validate the integrity of updates downloaded over HTTP, allowing an attacker to easily convince a user to execute arbitrary code
Severity: MEDIUM (CVSS v3 base score: 8.1)
Weakness: CWE-494 \u2014 Download of Code Without Integrity Check
The product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code.
Repository: https://github.com/pbatard/rufus
Files changed:
res/localization/rufus.loc
src/pki.c
src/rufus.rc
src/stdlg.c
Commit message: [pki] fix https://www.kb.cert.org/vuls/id/403768

* This commit effectively fixes https://www.kb.cert.org/vuls/id/403768 (CVE-2017-13083) as
  it is described per its revision 11, which is the latest revision at the time of this commit,
  by disabling Windows prompts, enacted during signature validation, that allow the user to
  bypass the intended signature verification checks.
* It needs to be pointed out that the vulnerability ("allow(ing) the use of a self-signed
  certificate"), which relies on the end-user actively ignoring a Windows prompt that tells
  them that the update failed the signature validation whilst also advising against running it,
  is being fully addressed, even as the update protocol remains HTTP.
* It also need to be pointed out that the extended delay (48 hours) between the time the
  vulnerability was reported and the moment it is fixed in our codebase has to do with
  the fact that the reporter chose to deviate from standard security practices by not
  disclosing the details of the vulnerability with us, be it publicly or privately,
  before creating the cert.org report. The only advance notification we received was a
  generic note about the use of HTTP vs HTTPS, which, as have established, is not
  immediately relevant to addressing the reported vulnerability.
* Closes #1009
* Note: The other vulnerability scenario described towards the end of #1009, which
  doesn't have to do with the "lack of CA checking", will be addressed separately.


Vulnerable code:
	if ((error_code >> 16) != 0x8009)
	trust_data.dwUIChoice = WTD_UI_ALL;
CAPTION "Rufus 2.17.1186"
 FILEVERSION 2,17,1186,0
 PRODUCTVERSION 2,17,1186,0
            VALUE "FileVersion", "2.17.1186"
            VALUE "ProductVersion", "2.17.1186"
				if (ValidateSignature(hDlg, filepath) != NO_ERROR)

Fixed code:
t MSG_240 "The signature for the downloaded update can not be validated. This could mean that your "
	"system is improperly configured for signature validation or indicate a malicious download.\n\n"
	"The download will be deleted. Please check the log for more details."
	if (((error_code >> 16) != 0x8009) && ((error_code >> 16) != 0x800B))
	case CERT_E_UNTRUSTEDROOT:
		return "The root certificate is not trusted.";
	case TRUST_E_NOSIGNATURE:
		return "Not digitally signed.";
	case TRUST_E_EXPLICIT_DISTRUST:
		return "One of the certificates used was marked as untrusted by the user.";
	// NB: WTD_UI_ALL can result in ERROR_SUCCESS even if the signature validation fails,
	// because it still prompts the user to run untrusted software, even after explicitly
	// notifying them that the signature invalid (and of course Microsoft had to make
	// that UI prompt a bit too similar to the other benign prompt you get when running
	// trusted software, which, as per cert.org's assessment, may confuse non-security
	// conscious-users who decide to gloss over these kind of notifications).
	trust_data.dwUIChoice = WTD_UI_NONE;
	switch (r) {
	case ERROR_SUCCESS:
		break;
	case TRUST_E_NOSIGNATURE:
		// Should already have been reported, but since we have a custom message for it...
		uprintf("PKI: File does not appear to be signed: %s", WinPKIErrorString());
		MessageBoxExU(hDlg, lmprintf(MSG_284), lmprintf(MSG_283), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
		break;
	default:
		uprintf("PKI: Failed to validate signature: %s", WinPKIErrorString());
		MessageBoxExU(hDlg, lmprintf(MSG_240), lmprintf(MSG_283), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
		break;
	}
CAPTION "Rufus 2.17.1187"
 FILEVERSION 2,17,1187,0
 PRODUCTVERSION 2,17,1187,0
            VALUE "FileVersion", "2.17.1187"
            VALUE "ProductVersion", "2.17.1187"
				if (ValidateSignature(hDlg, filepath) != NO_ERROR) {
					// Unconditionally delete the download and disable the "Launch" control
					_unlinkU(filepath);
					EnableWindow(GetDlgItem(hDlg, IDC_DOWNLOAD), FALSE);
				}