23. september 2010 - 14:45Der er
12 kommentarer og 1 løsning
spørgsmål til ASP.NET Security Vulnerability i asp.net 2.0
Jeg har en masse sites i asp.net 2.0 som i defaultRedirect redirecter til en aspx side for at opsamle evt. fejl. det skulle i forbindelse med det ny fundne sikkerhedhul, ikke være sikkert at gøre mere i 2.0. Hvordan kan man så opsamle fejl forsvarligt uden at skulle lave for meget om?
Enabling the Workaround on ASP.NET V1.0 to V3.5: If you are using ASP.NET 1.0, ASP.NET 1.1, ASP.NET 2.0, or ASP.NET 3.5 then you should follow the below steps to enable <customErrors> and map all errors to a single error page:
1) Edit your ASP.NET Application's root Web.Config file. If the file doesn't exist, then create one in the root directory of the application.
2) Create or modify the <customErrors> section of the web.config file to have the below settings:
Enabling the Workaround on ASP.NET V3.5 SP1 and ASP.NET 4.0
If you are using ASP.NET 3.5 SP1 or ASP.NET 4.0 then you should follow the below steps to enable <customErrors> and map all errors to a single error page:
1) Edit your ASP.NET Application's root Web.Config file. If the file doesn't exist, then create one in the root directory of the application.
2) Create or modify the <customErrors> section of the web.config file to have the below settings. Note the use of redirectMode="ResponseRewrite" with .NET 3.5 SP1 and .NET 4.0:
</configuration> 3) You can then add an Error.aspx to your application that contains an appropriate error page of your choosing (containing whatever content you like). This file will be displayed anytime an error occurs within the web application.
4) We recommend adding the below code to the Page_Load() server event handler within the Error.aspx file to add a random, small sleep delay. This will help to further obfuscate errors.
Jeg redirecter til samme fejlside for alle fejl. men der undre mig at der i eksemplet for 2.0 på ScottGu's side linkes til en html fil, mens der der for 4.0 linkes til en aspx fil?
Jeg har iøvrigt kørt det VB script som de har lavet på min webserver, og der melder den fejl hvis jeg linker til en aspx fil, men den siger ok, hvis jeg linker til en html fil.
Forskellen på de to eksempler, udover at du skal have en ekstra attribut på din customErrors-node, er at i 3.5 SP1 og 4.0 anbefales det at indlægge ydeligere kode på fejlsiden - se punkt 4 under "Enabling the Workaround on ASP.NET V3.5 SP1 and ASP.NET 4.0". Du kan altså fint have en aspx-side i første eksempel hvis det er det du har behov for.
Det undre mig bare at det script som microsoft har udviklet til at tjekke en webserver med, skriver en advarsel ved de sites der linker til en aspx fil, mens dem der linker til en html fil er ok.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.