Deprecated: Creation of dynamic property Timber\Site::$pingback is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Site.php on line 180

Deprecated: Creation of dynamic property Timber\User::$name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/User.php on line 118

Deprecated: Creation of dynamic property Timber\Post::$has_disclaimer is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_lock is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_last is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_meta_box_present is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_send_notification is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_modify_title_and_content is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_notification_custom_heading is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_notification_custom_content is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$tipologia is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_tipologia is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$attributi is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_attributi is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$in_evidenza_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_in_evidenza_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$inviato_in_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_inviato_in_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$fonte is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_fonte is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$fonte_url is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_fonte_url is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_category is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_blz_affiliation_attributes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_content_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_attributes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_speciali is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_focuskw is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_metadesc is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_linkdex is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_content_score is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_focuskeywords is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_keywordsynonyms is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_estimated-reading-time-minutes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_thumbnail_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$response_body is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_indexnow_last_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_date_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ping_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_password is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$to_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$pinged is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_content_filtered is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$guid is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$menu_order is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_mime_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_count is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$filter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71
Perché e quando DKIM non può attestare con certezza l'identità del mittente di un'email

Perché e quando DKIM non può attestare con certezza l'identità del mittente di un'email

Il sistema DKIM garantisce l'autenticità delle email, ma l'uso di chiavi RSA deboli rappresenta un rischio significativo. Uno studio di DMARC Checker ha dimostrato la vulnerabilità delle chiavi RSA di dimensioni ridotte, evidenziando la necessità di adottare chiavi più sicure per proteggere le comunicazioni.

Per cercare di mettere un freno al fenomeno dello spam e delle email truffaldine, sono stati inventati i record SPF, DMARC e DKIM i quali, usando diversi approcci, aiutano a verificare la legittimità di un’email e stabilire se il mittente è davvero colui che dichiara di essere nel campo From del messaggio. DKIM, acronimo di “DomainKeys Identified Mail“, è un metodo di autenticazione delle email progettato per garantire che i messaggi siano inviati da un mittente autorizzato e che non risultino alterati durante il percorso.

Come funziona DKIM

Il funzionamento di DKIM può essere suddiviso in più fasi. Innanzi tutto, il proprietario del nome di dominio genera una coppia di chiavi pubblica e privata. La chiave privata rimane sul server di posta, mentre la chiave pubblica va pubblicata come record DNS (Domain Name System) per il dominio.

All’invio di un’email, il server di posta utilizza la chiave privata per creare una firma digitale, aggiunta all’intestazione del messaggio. La firma rappresenta un’impronta unica del contenuto dell’email.

Una volta recapitata al destinatario, con l’intestazione contenente la firma DKIM, il suo server email pone in essere una verifica. In particolare, il server del destinatario effettua una query DNS per ottenere la chiave pubblica del mittente. Utilizzando la chiave pubblica, il server verifica se la firma corrisponde al contenuto dell’email. Se la verifica ha successo, l’email è autenticata e si presume che non sia stata manomessa. In base al risultato della verifica DKIM, il server di posta può decidere di accettare, rifiutare o contrassegnare l’email come potenzialmente sospetta.

DKIM non può attestare l’identità del mittente quando si usa una chiave RSA debole

Gli sviluppatori di DMARC Checker hanno condotto un importante studio sul primo milione di siti Web per traffico e importanza rilevando con sorpresa oltre 1.700 chiavi pubbliche DKIM con lunghezze inferiori a 1024 bit. La scoperta è significativa perché le chiavi RSA di dimensioni inferiori a 1.024 bit sono da tempo considerate insicure e il loro utilizzo con DKIM è stato  accantonato già nel 2018 con l’introduzione delle specifiche RFC 8301.

Tenendo presente quanto abbiamo spiegato in relazione alla sicurezza dell’algoritmo crittografico RSA, il team di esperti di DMARC Checker ha voluto provare a derivare la chiave privata da una chiave pubblica RSA, con il preciso obiettivo di firmare email in luogo del mittente autorizzato (gli utenti del dominio).

Per il loro esperimento, i tecnici di DMARC Checker hanno scelto il dominio di una nota impresa attiva nel settore dell’intermediazione immobiliare, individuando una chiave pubblica RSA a 512 bit associata al record DKIM. Per trovarla basta usare in Linux il comando dig +short TXT. La chiave pubblica, presente nel tag `p` del record DKIM, era codificata in formato ASN.1 DER e ulteriormente in Base64. Per decodificarla, è basato usare due righe di codice Python:

from Crypto.PublicKey import RSA
RSA.import_key('-----BEGIN PUBLIC KEY-----\n' + 'CHIAVE_PUBBLICA_RSA' + '\n-----END PUBLIC KEY-----')

Fattorizzazione dell’algoritmo RSA

L’intervento sulla chiave pubblica con il codice Python ha restituito due valori (𝑛 ed 𝑒):

  • 𝑛: è il modulo RSA, ottenuto moltiplicando i due numeri primi segreti 𝑝 e 𝑞. Il valore rappresenta la “dimensione” della chiave RSA e determina il suo livello di sicurezza. Più grande è 𝑛, più difficile è fattorizzarlo e, quindi, più sicura è la chiave.
  • 𝑒: è l’esponente pubblico, utilizzato insieme a 𝑛 per la cifratura o la verifica delle firme digitali. Di solito 𝑒 è scelto come un piccolo numero dispari, per ragioni di efficienza e sicurezza.

Trovato il modulo 𝑛, gli esperti sono passati a trovare i due numeri primi 𝑝 e 𝑞 il cui prodotto è uguale a 𝑛. Questo processo, noto come fattorizzazione, è computazionalmente complesso.

Per portarlo a termine con successo su una chiave RSA a 512 bit come quella utilizzata per il record DKIM dell’azienda di intermediazione immobiliare, i ricercatori di DMARC Checker hanno utilizzato uno strumento open source, CADO-NFS, che implementa un efficiente algoritmo, il più potente ad oggi noto, per fattorizzare grandi numeri interi.

L’operazione di fattorizzazione è stata eseguita sfruttando un server cloud con 8 vCPU dedicate (AMD EPYC 7003) e 32 GB di RAM. Dopo aver configurato il server Ubuntu e installato CADO-NFS, è bastato eseguire lo script Python cado-nfs.py, seguito dal valore 𝑛 per trovare 𝑝 e 𝑞. L’attività nel suo complesso ha richiesto meno di 8 dollari di investimento a fronte delle risorse cloud impegnate.

Ricostruzione della chiave privata RSA

Dopo aver ottenuto 𝑝 e 𝑞, è bastato ricorrere ancora una volta a uno script Python e alla libreria PyCryptodome per calcolare la chiave privata.

A questo punto, gli esperti hanno provato a inviare un’email verso alcuni noti provider Internet usando il nome di dominio altrui. Fortunatamente, Gmail e Outlook hanno rifiutato la firma DKIM apposta sul messaggio fraudolento. Altri provider, come Yahoo, Mailfence e Tutanota hanno tuttavia accettato l’email come valida, fornendo un risultato dkim=pass.

Considerazioni finali

Violazioni di chiavi RSA a 512 bit, un tempo impensabili utilizzando i normali computer, sono ora possibili in poche ore su server cloud con meno di 8 dollari.

L’esperimento condotto da DMARC Checker, che tra l’altro consente di verificare anche la configurazione dei propri server di posta, sottolinea l’urgenza di eliminare l’uso di chiavi di dimensioni inferiori a 1024 bit nel caso di DKIM.

In conclusione, i provider email dovrebbero rifiutare automaticamente firme DKIM con chiavi RSA inferiori a 1024 bit mentre gli amministratori dei domini dovrebbero verificare e aggiornare i record DKIM per garantire la conformità con gli standard attuali.

Il rischio non è soltanto di vedere le proprie email recapitate nella cartella spam (nei casi migliori…) ma anche quello di porgere il fianco a furti d’identità e altri tipologie di attacchi informatici.

Credit immagine in apertura: iStock.com – anyaberkut

Ti consigliamo anche

Link copiato negli appunti