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::$_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::$_oembed_82c0ee0994cee35f8111d53eab587f69 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::$_oembed_time_82c0ee0994cee35f8111d53eab587f69 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
Cos'è una fork bomb su Linux e come difendersi | IlSoftware.it

Cos'è una fork bomb su Linux e come difendersi

Jan Kopriva ha definito le fork bomb uno dei malware più semplici e pericolosi, in grado di sovraccaricare un sistema creando un numero infinito di processi. Come funzionano questi attacchi DoS su Linux.

Nel 2022, Jan Kopriva, docente ed esperto di sicurezza, è intervenuto con un interessante commento per spiegare quale, secondo lui, fosse il malware più semplice in circolazione. E ha puntato il dito verso le fork bomb, un tipo di attacco Denial of Service (DoS) che sfrutta la capacità di un sistema operativo di creare processi al fine sovraccaricare le risorse disponibili, in particolare CPU e RAM. Se controllate ad esempio sulla stessa Wikipedia, la fork bomb citata nel caso di Linux è la seguente: :(){ :|:& };:

Il comando, apparentemente benevolo, è invece studiato per consumare le risorse macchina rendendo il sistema progressivamente sempre più ingestibile, fino a provocare il crash dello stesso.

Gli attacchi fork bomb sono pericolosi perché creano continuamente ulteriori processi e assegnano loro nuove risorse, fino al completo esaurimento.

Come funziona un attacco fork bomb su Linux

Indipendentemente dal sistema operativo o dal linguaggio di programmazione utilizzato, le fork bomb funzionano tutte allo stesso modo. Nel caso del comando :(){ :|:& };: (che non va assolutamente utilizzato su nessun sistema Linux “in produzione”), la sintassi è volutamente criptica.

Basti pensare che il simbolo : iniziale definisce una funzione chiamata : (il nome della funzione è un semplice due punti). La porzione () { :|:& }: è il corpo della funzione, che si richiama da sola due volte utilizzando il simbolo pipe. Sono così creati due processi figli. Con il simbolo &, ogni chiamata è eseguita in background: in questo modo il processo principale può continuare a funzionare.

Mentre il carattere ; termina la definizione della funzione, il due punti finale richiama la funzione appena definita, innescando di fatto un ciclo infinito.

Per rendere il tutto più chiaro, assegnando un nome “umano” alla funzione e usando opportunamente l’indentazione, si potrebbe scrivere il seguente comando equivalente:

dos() { 
 dos | dos &
}; dos

Le conseguenze di una fork bomb sono evidenti e consistono in un repentino e rapido aumento del numero di processi (task) in esecuzione oltre che del carico medio del sistema. La macchina diventa lenta e non risponde più, cessando poi di funzionare (crash).

Come evitare gli effetti più gravi delle fork bomb

Abbiamo sottolineato in precedenza che l’utilizzo del comando :(){ :|:& };: porta all’impossibilità di gestire qualunque sistema Linux. L’unico modo per riprenderne il controllo è effettuare un riavvio fisico della macchina. Questo potrebbe essere un grave problema per i sistemi server che, notoriamente, sono gestiti utilizzando SSH e altre soluzioni di accesso remoto.

Chi volesse fare qualche esperimento, quindi, lo faccia solo ed esclusivamente attrezzandosi con una macchina virtuale creata allo scopo.

Gli account root hanno accesso illimitato alle risorse, quindi una fork bomb eseguita con i privilegi di root causerà inevitabilmente un crash. Tuttavia, gli account sprovvisti dei privilegi più ampi possono essere impostati in maniera tale da non poter impegnare troppe risorse. La direttiva max user processes, ad esempio, è essenziale per definire il numero massimo di processi che ciascun account può creare.

Il limite correntemente impostato può essere verificato mediante il comando ulimit -u. Definendo il numero massimo di processi eventualmente instanziabili, si impedisce a una fork bomb di consumare tutte le risorse del sistema. Il comando ulimit -a offre una panoramica completa su tutte le impostazioni rilevanti.

Con ulimit -S -u, seguito dal numero dei processi attivabili da ciascun account, è possibile neutralizzare gli effetti di un attacco.

Conclusioni

Le fork bomb sono ben più di una semplice curiosità. Come spiegato nell’introduzione, sono attacchi deliberati che possono causare danni sui sistemi usati in produzione.

Per questo è di fondamentale importanza comprenderne il funzionamento e le possibili conseguenze. L’utilizzo responsabile delle risorse di sistema e l’implementazione di opportune misure di sicurezza, come l’applicazione di limiti sui processi degli utenti, possono mitigare i rischi.

Ti consigliamo anche

Link copiato negli appunti