{
  "id": "2023/577",
  "url": "https://opencryptology.org/2023/577",
  "original_url": "https://eprint.iacr.org/2023/577",
  "title": "Exploring Formal Methods for Cryptographic Hash Function Implementations",
  "authors": [
    "Nicky Mouha"
  ],
  "affiliations": null,
  "abstract": "Cryptographic hash functions are used inside many applications that critically rely on their resistance against cryptanalysis attacks and the correctness of their implementations. Nevertheless, vulnerabilities in cryptographic hash function implementations can remain unnoticed for more than a decade, as shown by the recent discovery of a buffer overflow in the implementation of SHA-3 in the eXtended Keccak Code Package (XKCP), impacting Python, PHP, and several other software projects. This paper explains how this buffer overflow vulnerability in XKCP was found. More generally, we explore the application of formal methods to the five finalist submission packages to the NIST SHA-3 competition, allowing us to (re-)discover vulnerabilities in the implementations of Keccak and BLAKE, and also discover a previously undisclosed vulnerability in the implementation of Grøstl. We also show how the same approach rediscovers a vulnerability affecting 11 out of the 12 implemented cryptographic hash functions in Apple's CoreCrypto library. Our approach consists of removing certain lines of code and then using KLEE as a tool to prove functional equivalence. We discuss the advantages and limitations of our approach and hope that our attempt to consolidate some earlier approaches can lead to new insights.",
  "category": "Implementation",
  "license": {
    "code": "CC0",
    "url": "https://creativecommons.org/publicdomain/zero/1.0/",
    "label": "CC0 1.0",
    "attribution": "“Exploring Formal Methods for Cryptographic Hash Function Implementations” by Nicky Mouha, Cryptology ePrint Archive, Paper 2023/577, https://eprint.iacr.org/2023/577. Licensed under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/).",
    "retroactive": false,
    "redistribute_verbatim_only": false,
    "non_commercial": false
  },
  "dates": {
    "submitted": "2023-04-24T01:06:12Z",
    "updated": "2023-04-24T01:06:12Z",
    "withdrawn": null
  },
  "withdrawn": false,
  "withdrawn_on": null,
  "pdf": {
    "url": "https://opencryptology.org/2023/577.pdf",
    "sha256": "4e4acb1f1765ea19efb8ce8a22e2f6abd52d09204ceeed01f65c6196c47a843a",
    "size": 322807,
    "source": "github-mirror",
    "source_date": "2024-01-14T06:13:41Z",
    "maybe_stale": false,
    "newer_on_eprint": null,
    "withdrawn": false
  },
  "versions": [
    {
      "url": "https://opencryptology.org/2023/577/versions/20240114T061341Z.pdf",
      "captured_at": "2024-01-14T06:13:41Z",
      "label": "copy captured 2024-01-14",
      "source": "github-mirror",
      "source_url": "https://raw.githubusercontent.com/arturo-kong/IACR-eprint-mirror/master/2023/577.pdf",
      "size": 322807,
      "sha256": "4e4acb1f1765ea19efb8ce8a22e2f6abd52d09204ceeed01f65c6196c47a843a",
      "is_default_pdf": true
    }
  ],
  "other_sources": [
    {
      "kind": "wayback",
      "url": "https://web.archive.org/web/20251230040517id_/https://eprint.iacr.org/2023/577.pdf",
      "captured_at": "2025-12-30T04:05:17Z",
      "size": 323715
    },
    {
      "kind": "github-mirror",
      "url": "https://raw.githubusercontent.com/arturo-kong/IACR-eprint-mirror/master/2023/577.pdf",
      "captured_at": "2024-01-14T06:13:41Z",
      "size": 322807
    }
  ],
  "bibtex": "@misc{cryptoeprint:2023/577,\n      author = {Nicky Mouha},\n      title = {Exploring Formal Methods for Cryptographic Hash Function Implementations},\n      howpublished = {Cryptology {ePrint} Archive, Paper 2023/577},\n      year = {2023},\n      url = {https://eprint.iacr.org/2023/577}\n}"
}
