473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

understanding .NET security

I think that I start to understand this .NET security.

Basically it comes to this:

* You use strong names in the dll and exe, so the application user must
configure this application with key one time that it can be trusted.
Similar like ActiveX but no dialog box is shown.

* The program tells the JIT compiler what rights it need.
For example, a clock would not need file access, so it could tell the JIT
that it does not use the FileIOPermission for file access.
This way, a hacker cannot misuse this clock program to write a file to
the windows folder.

Jul 21 '05 #1
1 1796
> I think that I start to understand this .NET security.

Basically it comes to this:

* You use strong names in the dll and exe, so the application user must
configure this application with key one time that it can be trusted.
Similar like ActiveX but no dialog box is shown.

* The program tells the JIT compiler what rights it need.
For example, a clock would not need file access, so it could tell the JIT that it does not use the FileIOPermission for file access.
This way, a hacker cannot misuse this clock program to write a file to
the windows folder.


And I must add these hints too

* You need a .config file at the same location of the exe file and the used
dll's to
make .NET be able to find the newly provided dll's.
I have been fighting some problems with the JIT compiler incorrectly
claming that
he did not find the correct dll, while they were just right there.

* If one of these dll's uses the dynamic MFC dll's then add these to the
folder too.
(mfc70.dll, msvcp70.dll and msvcr70.dll for VC++ 2002)
Do not expect that MFC is installed on that machine.
(The odd thing is that .NET 1.0 have these dll's in it's folder, but
apparently does
not put this in a search path.

* Put something like this to your main() in order to see why the pogram
crashes.
try {
Application.Run(new Form1());
} catch (SecurityException e) {
MessageBox.Show("Not enough security rights to run this
program!\r\r"+e.ToString()+"\r\rThis program will now terminate!",
"ctRepair: Security
error",MessageBoxButtons.OK,MessageBoxIcon.Error);
} catch (Exception e) {
MessageBox.Show("This program caused an unknown
exception!\r\r"+e.ToString()+"\r\rThis program will now terminate!",
"ctRepair: Unknown
exception",MessageBoxButtons.OK,MessageBoxIcon.Err or);
}

* Use Microsoft FxCop to inspect your .NET created DLL's if they are
reusable for other languages.
This program helped me a lot to help port my code.

* Add this to your assembly file (C# example) if you are porting existing
unmanaged C++ code to managed code.
It gives too much security rights but at least the code runs like an
older .exe program, and can be started from a
network driver, open network folder, read/write the registery and access
any folder on your local machine....
In a next stage you can start revoking these righst step by step.

using System;
using System.Security;
using System.Security.Permissions;

[assembly:SecurityPermission(SecurityAction.Request Minimum,
UnmanagedCode=true)]
[assembly:FileIOPermission(SecurityAction.RequestMi nimum,
Unrestricted=true)]
[assembly:RegistryPermission(SecurityAction.Request Minimum, All="*")]

[assembly:ZoneIdentityPermission(SecurityAction.Req uestMinimum,Zone=Security
Zone.NoZone)]

[assembly:ComVisible(true)]
[assembly:CLSCompliant(true)]

Well, I hope that this overview avoids other people becoming depressed when
all seems to fail when they start using .NET for the first time. ;-)
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: j-marvin | last post by:
hi- i am using the abyss webserver at the moment. i went through the process of how a buffer overflow would work in my mind. i noticed you can limit the size of post data and its limit value is...
7
by: CheGueVerra | last post by:
First of all Hello all you css freak. geeks and gurus. I just started using css for some web pages I had to do at work and I'im testing some stuff at home to understand more. Now, I wanted to...
9
by: Marty McDonald | last post by:
If I invoke a web service, and it throws an exception, I can see the exception if the client app is a .Net app. However, if the client app is not a .Net app, I only receive the HTTP 500 error. I...
29
by: RAY | last post by:
Hi , my boss has asked I sit in on an interview this afternoon and that I create some interview questions on the person's experience. What is C++ used for and why would a company benefit from...
1
by: | last post by:
I think that I start to understand this .NET security. Basically it comes to this: * You use strong names in the dll and exe, so the application user must configure this application with key...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
4
by: joelagnel | last post by:
I'm new to .NET and have a basic understanding of operating systems. I can also do some magic in Csharp, but I lack an understanding of what's going on under the hood, with respect to how windows...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.