Debian Codegraph @

crt/s2n/scram/README.md

raw symbols SCIP
1 # Preview: SCRAM -- Short Cut Resistant AEAD Mode
2
3 <img src="../docs/images/scram_intro.png" alt="scram">
4
5 SCRAM is a symmetric encryption mode, based on AES-GCM, that includes new
6 cryptographic protections against dangerous short-cuts that applications
7 sometimes take.
8
9 ## Cryptographic protection against release of unauthenticated plaintext
10
11 Modern cryptographic libraries offer 'in place' encryption and decryption. By
12 avoiding copies of the memory, encrypting and decrypting data in place saves
13 both memory and CPU. While offering great performance, this interface depends
14 on a promise from the application developer not to use or look at the decrypted
15 plaintext until it has been authenticated by the cryprographic library.
16 Application developers do not always appreciate that this authentication occurs
17 only once the entire message has been received, and that it is not safe to
18 process the data until then.
19
20 There are two variants of this misuse:
21
22 1. Some applications do not perform the final 'authenticate this data'
23 operation, or do not check the return status of this operation. Although
24 encryption libraries such as Amazon s2n do include tests that simulate malicious
25 attackers injecting corrupted traffic, this is not a common or easy kind of
26 test for applications to include. An application with this error will appear to
27 work correctly, and will handle correctly encrypted and authenticated data
28 without error, however the application will also accept corrupt or malicious
29 input; usually a high severity security issue.
30
31 2. Some applications deliberately use decrypted plaintext before it has been
32 authenticated, in order to get a 'head start' on work. For example, an
33 application may decompress a compressed payload before it has been
34 authenticated, or may optimistically execute a dependent operation such as a
35 web-request. The application developers may believe that this is 'ok' as long
36 as the work is 'cancelled' or 'undone' should the message fail authentication.
37 However this is rarely done with a full appreciation for the information
38 side-channels that are introduced by optimistic operations, or the inherent
39 risk of denial of service attacks.
40
41 SCRAM adds misuse resistance for both kinds of issues.
42
43 When using SCRAM, a recipient simply must first (correctly) compute the message
44 authentication code in order to subsequently decrypt it. There is no
45 significant benefit to skipping this step. If an application does fail to check
46 the result of the message authentication operation, and uses the 'decrypted'
47 data prematurely, the corrupt message will result in a 'random garbage'
48 plaintext. Crucially, an attacker has no control over this random garbage.
49
50 <img src="../docs/images/scram_example.png" alt="">
51
52 For applications that are using SCRAM to simply encrypt bulk data, this kind of
53 application failure still results in data corruption. But for applications that
54 are using SCRAM to encrypt data that must conform to a schema, or data that
55 contains instructions, this kind of application failure is generally much
56 safer. Without any control over the data that is decrypted, an attacker's
57 ability to abuse the application failure, or to find meaningful decryption or
58 message forgery oracles is severely limited.
59
60 ## Integration of message padding into the AEAD layer
61
62 Modern cryptography is extremely good at disguising data as meaningless noise,
63 however analysis of encrypted data volumes and traffic timings remains the most
64 practical attack on well-encrypted information.
65
66 Without any measures to prevent these attacks, the size and timing of encrypted
67 messages can be enough information for an attacker (who has access to the
68 encrypted data) to decipher a voice call, determine the keystrokes used in a
69 password, or to identify content being accessed by using size-based
70 fingerprints.
71
72 To enhance protection against these risks, SCRAM integrates message padding
73 directly into the AEAD encryption layer. The caller indicates a desired 'frame
74 size' and SCRAM will ensure that every encrypted message is rounded up (if
75 needed) to a whole number of frames. Frames can be aligned with network
76 boundaries, such as record sizes or TCP segment sizes, or they can be aligned
77 with storage boundaries such as page sizes or block sizes. It's up to the
78 application.
79
80 By integrating padding, SCRAM handles the details that developers can sometimes
81 get wrong, for example many application developers mistakenly believe that a
82 random amount of padding is sufficient to hide the length of a message.
83
84 Applications using SCRAM don't have to use padding, it's not enforced, but
85 adding padding to the AEAD layer acts as a noteworthy reminder to application
86 developers and code-auditors that obfuscation of message sizes and timings is
87 an important consideration for cryptographic systems. For example, it will
88 be noticeable during a code-review that padding has not been chosen.
89
90 ## SCRAM algorithm
91
92 SCRAM is being developed as part of Amazon s2n and is open source. The working
93 specification of the SCRAM algorithm is maintained in Python.
94
95 There are several ways of achieving SCRAM's cryptographic goals, but our
96 choices are heavily guided by ensuring that SCRAM's security proofs can be
97 simple, robust, and build on top of well-established properties of existing
98 cryptographic primitives.
99
100 The design of SCRAM is also intended to make use of operations that are already
101 accelerated in hardware on common platforms including Amazon EC2 instances, the
102 AWS Nitro Platform, commidity and embedded systems.
103
104 SCRAM is not yet finalized; some performance sensitive details of SCRAM may
105 change as we experiment with different workloads and datasets. We are always
106 open to feedback from application developers about how SCRAM may be useful in
107 their applications.
108
109 Once measurements and any changes are finalized, we will be publishing a final
110 SCRAM specification, accompanying security proofs, and other learnings.
111
112 ## SCRAM material
113
114 * [Watch AWS CISO Stephen Schmidt announce SCRAM](https://www.youtube.com/watch?time_continue=2489&v=oam8FDNJhbE)
115
116 ## SCRAM team
117
118 SCRAM is designed and maintained by Shay Gueron, Colm MacCarthaigh, and Alex
119 Weibel from the AWS Cryptography team. Shay Gueron is also a professor at the
120 University of Haifa.
121