Skip to content
Crypto Disclosed report Advanced

Phabricator is vulnerable to padding oracle attacks and chosen-ciphertext attacks.

Phabricator encrypts stored files with AES-256-CBC but does not authenticate the ciphertext, so an attacker who can submit modified encrypted data may be able to decrypt or tamper with it via padding oracle or chosen-ciphertext attacks.

edoverflow Follow

Originally disclosed on HackerOne

Bounty$750 Medium 5.3 View original
  • Triaged in 2 days
  • Fixed in 8 days
  • Paid in 8 days
  • Disclosed after 8 days

Dear Phabricator bug bounty team,

Summary


Phabricator encrypts data with AES in CBC mode, but does not ensure integrity of the encrypted data. You must authenticate the data, by either using an HMAC or by using an authenticated block cipher mode like GCM.

Why does this vulnerability exist?


src/applications/files/format/PhabricatorFileAES256StorageFormat.php encrypts the data as follows without checking the integrity of the message:

private function encryptData(
    $data,
    PhutilOpaqueEnvelope $key,
    PhutilOpaqueEnvelope $iv) {
    $method = 'aes-256-cbc';
    $key = $key->openEnvelope();
    $iv = $iv->openEnvelope();
    $result = openssl_encrypt($data, $method, $key, OPENSSL_RAW_DATA, $iv);
    if ($result === false) {
      throw new Exception(
        pht(
          'Failed to openssl_encrypt() data: %s',
          openssl_error_string()));
    }
    return $result;
}

Link to source code: https://github.com/phacility/phabricator/blob/master/src/applications/files/format/PhabricatorFileAES256StorageFormat.php

How can this be exploited?


By not ensuring integrity Phabricator is vulnerable to padding oracle attacks and chosen-ciphertext attacks.

How can this be fixed?


As stated previously, you must check the integrity of the data, by either using an HMAC or by using an authenticated block cipher mode like GCM.

Best regards, Ed

The original report as published on HackerOne, by edoverflow. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The encryption routine uses AES-256-CBC without an HMAC or an authenticated mode, so ciphertext integrity is never verified.

What the attacker needed

None stated in the report

The fix

The data should be authenticated using an HMAC or an authenticated block cipher mode such as GCM.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Encryption hides data, but without a way to check that nobody changed it, an attacker can alter the encrypted data and watch how the system reacts. That feedback can let them decrypt secrets or forge modified data. This report says Phabricator's file encryption lacks that integrity check.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by edoverflow

View all

27 more disclosed reports, best first.

More from Phabricator

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.