In queste due settimane mi sto informando sulla sicurezza delle applicazioni ASP e sto vedendo che ci sono molte cose a cui non avevo pensato...
Ho visto che un altro utente ha postato questa pagina: http://msdn2.microsoft.com/en-us/library/ms526079.aspx
Ad un certo punto viene scritto:
When working with files, canonicalize and verify all resource names such as file names, server names, user names, and so on.
When creating files, use CreateFile with dwFlagsAndAttributes != 0, or call GetFileType after calling CreateFile to verify that a file is of the correct type (FILE_TYPE_DISK). In ISAPI applications, use the SCRIPT_TRANSLATED server variable to get a canonicalized filename from the URL.
Canonicalization refers to the practice of converting resource names to a common format, for example, converting 8dot3 names and relative file paths to full physical paths before working with the path name.
Malicious users can use 8dot3 representations of paths to gain access to files that they would otherwise be denied. They might also be able to force an application to create a different file type, such as a names pipe, mailslot, or other communication resource.
Secondo voi l'uso di server.mappath è sicuro? Non è che in qualche modo può venire manipolato e, se per esempio lo uso per recuperare il percorso di un file e leggerlo, mi faccia leggere un file presente su un altro server o da qualche altra parte? Secondo voi inserire direttamente il percorso fisico del file sul server è più sicuro?

Rispondi quotando