In the wake of the chip-apocalypse news of 2018, when almost everything was hacked, and world brand sites, without knowing it, minting cryptocurrency in our browsers, we decided to encroach on the holy of holies and hack documents signed with an enhanced qualified electronic signature. And that's what came of it.
As you know, enhanced qualified electronic signature (ES) allows you to identify the person who signed the document and detect the fact of making changes to the document (see Art. 5, p. 3 of Federal Law No. 63 “On Electronic Signature”). The hash function collision generation algorithm is not needed this time. For hacking, it is necessary to find ways to make changes to the electronic document after its signing, so that these changes are not detected when checking the ES. Let's start.
Hereinafter, it is assumed that the system has already installed a certificate of qualified electronic signature:
We realize attack:
This time we will use the most advanced CryptoPro CSP 4.0 information security complex, which corresponds to the standard GOST R 34.10-2012:
We realize attack:
These are effective, but not the only ways to attack. There are also macros, calculated field values, styles. Neither the use of a data management system (PDM), unfastened signatures, or the use of specialized cryptographic complexes such as CryptoPro CSP will protect against them.
How to provide protection against such attacks? The most effective way is to publish documents in an uneditable format or fixed markup format. These formats are aimed at preserving the original form of the document on any device, anywhere in the world. Here are the most common representatives of fixed markup formats:
But here is not so simple. Let's try to attack through a font on a signed PDF document:
We realize attack:
For PDF, it was possible to implement this type of attack because this format allows the use of fonts by reference, so it is not suitable for creating originals. There is a PDF / A standard (a subset of PDF) that provides the necessary protection. Therefore, before signing each PDF, you must make sure that the document conforms to the PDF / A standard or that there are no dependencies on fonts.
The DWFx and XPS formats are not subject to such attacks, since at the level of the ECMA-388 standard the storage of resources within the content of documents is regulated (F.3.1 M2.6). But DWFx is not suitable for creating multi-page text documents, so the most versatile option is XPS.
Let's try, by analogy with PDF, to conduct an attack through a font on a signed XPS document:
We realize attack:
Reinforced qualified electronic signature is still a reliable technology for detecting changes to a document. But we must comprehensively evaluate the effectiveness of its application. The experiment showed that the editable formats DWG, DOC, DOCX are not suitable for creating electronic scripts, since they can be easily compromised. PDF / A and XPS formats are more secure and versatile for creating originals, since they contain all the necessary information inside the file in order to display the document unchanged each time.
Dmitry Poskrebyshev
Source: https://habr.com/ru/post/347016/