03.06.2013 Views

Un modello integrato control-flow e data-flow per il rilevamento ...

Un modello integrato control-flow e data-flow per il rilevamento ...

Un modello integrato control-flow e data-flow per il rilevamento ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

18 2. Modelli <strong>per</strong> l’anomaly detection<br />

possib<strong>il</strong>e e realistico costruire degli attacchi (non-<strong>control</strong> <strong>data</strong> attacks) che non hanno<br />

bisogno di portare <strong>il</strong> sistema ad eseguire codice malevolo. Dal loro studio emerge che<br />

oltre ad essere <strong>per</strong>fettamente possib<strong>il</strong>e, la gravità degli attacchi non-<strong>control</strong> <strong>data</strong> è<br />

equivalente a quella dei più classici <strong>control</strong>-<strong>data</strong>. In [4] vengono identificate 4 classi<br />

di dati critici <strong>per</strong> la sicurezza del software:<br />

• dati di configurazione<br />

• input dell’utente<br />

• identità dell’utente<br />

• dati di decision-making<br />

1 #define STRSZ 32<br />

2<br />

3 int authenticate(char *user, char *password) {<br />

4 if ( (strncmp(user, "matteo", STRSZ) == 0) &&<br />

5 (strncmp(password, "pippo123", STRSZ) == 0) )<br />

6 return 1;<br />

7<br />

8 return 0;<br />

9 }<br />

10<br />

11 int main(void) {<br />

12 int authenticated = 0;<br />

13 char user[32], password[32];<br />

14<br />

15 gets(user);<br />

16 gets(password);<br />

17<br />

18 if ( authenticate(user, password) )<br />

19 authenticated = 1;<br />

20<br />

21 if (authenticated) system("/bin/sh");<br />

22 else printf("Not allowed\n");<br />

23 }<br />

Figura 2.6: Banale programma vulnerab<strong>il</strong>e ad un non-<strong>control</strong> <strong>data</strong> attack.<br />

Delle quattro l’ultima è sicuramente la più interessante: vi sono alcuni dati che so-<br />

no necessari affinché un programma decida che azione intraprendere e, riuscendo a<br />

corrom<strong>per</strong>li, è possib<strong>il</strong>e portare un programma a fare qualcosa di contrario rispetto<br />

a ciò che andrebbe fatto. Prendiamo ad esempio <strong>il</strong> programma di Figura 2.6: <strong>il</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!