Comments (1)
I really really appreciate that you open this issue!! thanks. 👍
Unfortunately, the security cheat sheet
was too simple that programmers SHOULD NOT just copy past the code. It will case lots of security issues. I will give a warning on the top of cheat sheet soon.
based on karanlyons said:
The AES examples use CBC with PKCS7 and no MAC, which is the classic example of a scheme open to padding oracle attacks. Nowadays I’d recommend GCM (or EAX) as your block mode if it’s available, and otherwise CTR or CBC with a MAC on the IV & ciphertext using a separate key. And I wouldn’t consider myself within even spitting distance of a crypto expert.
What’s weird is that cryptography has all of those primitives, so it’s concerning that the author didn’t use them. The key stretching is also using a custom function as opposed to one of the KDFs in cryptography as well (it looks like the function is basically HKDF, but the first rule of crypto is “don’t roll your own crypto,” so at the very least we could use the primitives).
There’s also no guarding against nonce/IV reuse (which is a bad idea in general, but thankfully not catastrophic for CBC) in the symmetric crypto. Worse, the key & IV are derived from the initial key, guaranteeing that any given key will always have the same IV, which opens you up to all sorts of attacks based around inference of plaintexts from a corpus of ciphertexts (With CBC if (Key₁, IV₁) == (Key₂, IV₂) then if C₁ == C₂, P₁ == P₂. Additionally the first block is now effectively in ECB mode. With CTR/GCM/EAX/etc. the results are way worse).
There’s probably more stuff wrong, too (like the stuff around certificates seemingly ignoring any trust model, and the implication of a lack of understanding as to the maximum message length given a key size), but that’s what I found from a quick glance. The one bit of good news is that if you just use TLS with strong cipher suites (and a trusted cert with pinning) almost all of this will be done properly for you.
I get the intent behind this, and I think that intent is genuinely good, but crypto is really not a place where you want to be giving any advice unless you’re either an expert or willing to couch your advice in a bunch of caveats.
(Also, and somewhat tangential: if we’re going to put together a “this is how you do things” cheatsheet, it wouldn’t hurt to espouse the most modern stuff we’ve got: ECDSA, AES-GCM, ECDHE, ECC and AEAD in general, scrypt, etc.)
I agree that there still have a lot of work to do ...
from pysheeet.
Related Issues (20)
- DateTime Column is not coded properly HOT 3
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- Migrate alll codes to just python 3 HOT 6
- mapper() func is deprectiated HOT 1
- There doesn't seem to be any coverage of 'map()'
- c o
- /%0在@
- 国-酩酊大醉 ***★......ᄒ笔7卤
- P. List
- Weird variable name
- pep-0328 - guido-s-decision
- Default to Python 3 compatibility HOT 3
- New version of fundamental cheat sheets
- Review advanced cheat sheets
- Add boto3
- Appendix: Why does Decorator Need @wraps
- Appendix: Yet Another Introduction to Asyncio HOT 3
- Cheatsheet for string manipulations HOT 4
- Iterator 404 HOT 1
- sqlalchemy cheat sheet: Reflect=True is depreciated. Change to use the reflect() method HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysheeet.