skip to main content
10.1145/3488932.3527284acmconferencesArticle/Chapter ViewAbstractPublication Pagesasia-ccsConference Proceedingsconference-collections
poster

Base64 Malleability in Practice

Published:30 May 2022Publication History

ABSTRACT

Base64 encoding has been a popular method to encode binary data into printable ASCII characters. It is commonly used in several serialization protocols, web, and logging applications, while it is oftentimes the preferred method for human-readable database fields. However, while convenient and with a better compression rate than hex-encoding, the large number of base64 variants in relted standards and proposed padding-mode optionality have been proven problematic in terms of security and cross-platform compatibility.

This paper addresses a potential attack vector in the base64 decoding phase, where multiple different encodings can successfully decode into the same data, effectively breaking string uniqueness guarantees. The latter might result to log mismatches, denial of service attacks and duplicated database entries, among the others. Apart from documenting why canonicity can be broken by a malleable encoder, we also present an unexpected result, where most of today's base64 decoder libraries are not 100% compatible in their default settings. Some surprising results include the non-compatible behavior of major Rust base64 crates and between popular Javascript and NodeJS base64 implementations. Finally, we propose ways and test vectors for mitigating these issues until a more permanent solution is widely adopted.

Skip Supplemental Material Section

Supplemental Material

base64-presentation.mp4

mp4

127.1 MB

References

  1. J. Callas, L. Donnerhacke, H. Finney, D. Shaw, and R. Thayer. 2007. Request for Comments: 4880. https://datatracker.ietf.org/doc/html/rfc4880Google ScholarGoogle Scholar
  2. Konstantinos Chalkias, Francc ois Garillot, and Valeria Nikolaenko. 2020. Taming the Many EdDSAs. In Security Standardisation Research.Google ScholarGoogle Scholar
  3. M. Crispin. 2003. Request for Comments: 3501. https://datatracker.ietf.org/doc/html/rfc3501#section-5.1.3Google ScholarGoogle Scholar
  4. Kevin Fiscus. 2011. Base64 Can Get You Pwned. https://www.sans.org/white-papers/33759/Google ScholarGoogle Scholar
  5. N. Freed and N. Borenstein. 1996. Request for Comments: 2045. https://datatracker.ietf.org/doc/html/rfc2045#page-24Google ScholarGoogle Scholar
  6. D. Goldsmith and M. Davis. 1997. Request for Comments: 2152. https://datatracker.ietf.org/doc/html/rfc2152Google ScholarGoogle Scholar
  7. S. Josefsson. 2006. Request for Comments: 4648. https://datatracker.ietf.org/doc/html/rfc4648#section-3.5Google ScholarGoogle Scholar
  8. Simon Josefsson and Sean Leonard. 2015. Textual encodings of PKIX, PKCS, and CMS structures. Internet Engineering Task Force April (2015).Google ScholarGoogle Scholar
  9. Kostas Kryptos. 2021. 3rd time that I find a serious exploitable bug in a multi-million business website. https://www.linkedin.com/posts/chalkiaskostas_programming-python-databases-activity-6820220132233748480--8teKGoogle ScholarGoogle Scholar
  10. J. Linn. 1993. Request for Comments: 1421. https://datatracker.ietf.org/doc/html/rfc1421Google ScholarGoogle Scholar
  11. Ajeet Ram Pathak, Sarita Deshpande, and Mudra Panchal. 2019. A Secure Framework for File Encryption Using Base64 Encoding. In Computing and Network Sustainability, Sheng-Lung Peng, Nilanjan Dey, and Mahesh Bundele (Eds.).Google ScholarGoogle Scholar
  12. Prabath Siriwardena. 2020. Base64 URL Encoding .Apress, Berkeley, CA, 397--399.Google ScholarGoogle Scholar
  13. Daniel Smallwood. 2021. Hacker Pig Latin: A Base64 Primer for Security Analysts. https://www.darkreading.com/edge-articles/hacker-pig-latin-a-base64-primer-for-security-analystsGoogle ScholarGoogle Scholar
  14. Wen Somchai and Dang Wen. 2018. Research on Base64 Encoding Algorithm and PHP Implementation. In Geoinformatics.Google ScholarGoogle Scholar
  15. Mars Caroline Wibowo, Phong Thanh Nguyen, Edmond Febrinicko Armay, and Robbi Rahim. 2020. Implementation of Base64 and caesar cipher in securing video files., Vol. 12, 2 (2020), 761--765. https://doi.org/10.5373/JARDCS/V12I2/S20201093Google ScholarGoogle Scholar

Index Terms

  1. Base64 Malleability in Practice

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          ASIA CCS '22: Proceedings of the 2022 ACM on Asia Conference on Computer and Communications Security
          May 2022
          1291 pages
          ISBN:9781450391405
          DOI:10.1145/3488932

          Copyright © 2022 Owner/Author

          Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 30 May 2022

          Check for updates

          Qualifiers

          • poster

          Acceptance Rates

          Overall Acceptance Rate418of2,322submissions,18%

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader