_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

OWASP Top 10: Cryptographic Failures

28. 03. 2024 1 min read intermediate

Dříve známé jako Sensitive Data Exposure. Špatná kryptografie znamená úniky hesel, platebních údajů a osobních dat.

Common Mistakes

  • Ukládání hesel v plaintextu nebo s MD5/SHA1
  • Použití HTTP místo HTTPS
  • Hardcodované šifrovací klíče v kódu
  • Slabé algoritmy (DES, RC4, SHA1 pro podpisy)
  • Nedostatečná délka klíčů (RSA < 2048 bit)

Správné hashování hesel

import bcrypt password = b”tajne_heslo” hashed = bcrypt.hashpw(password, bcrypt.gensalt(rounds=12)) bcrypt.checkpw(password, hashed) # True

Argon2 (doporučeno OWASP)

from argon2 import PasswordHasher ph = PasswordHasher(time_cost=3, memory_cost=65536, parallelism=4) hash = ph.hash(“tajne_heslo”) ph.verify(hash, “tajne_heslo”)

Šifrování dat — AES-256-GCM

from cryptography.hazmat.primitives.ciphers.aead import AESGCM import os key = os.urandom(32) # 256-bit klíč nonce = os.urandom(12) aesgcm = AESGCM(key) ct = aesgcm.encrypt(nonce, b”citliva data”, b”aad”) pt = aesgcm.decrypt(nonce, ct, b”aad”)

Checklist

  1. Klasifikujte data podle citlivosti
  2. Šifrujte vše citlivé at rest i in transit
  3. Používejte AES-256, RSA-2048+, SHA-256+
  4. Hesla hashujte s Argon2id nebo bcrypt
  5. Klíče ukládejte v key vault (Azure KV, AWS KMS, Vault)
  6. Pravidelně rotujte klíče
  7. Vynutte HTTPS s HSTS hlavičkou

Key Takeaway

Šifrujte vše citlivé, používejte moderní algoritmy a nikdy neukládejte klíče v kódu. Kryptografie je obor, kde ‘skoro správně’ znamená ‘úplně špatně’.

owaspsecuritykryptografie
Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.