473,659 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ Runtime DLL's needed in application.. best way to grant security?

Hello,

I have an asp.net application (using vb.net codebehind), that is calling
some older c++ dlls. These dlls require the use of the c++ Runtime which is
in the windows/System32 directories. What is the best way to get access to
these directories for the web application?

Add the security for IUSR_<system name> to the System32 directory?

Is there a better method?

Thanks!

Jim
Nov 18 '05 #1
3 2406
Hi James,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you'd like to use some older c++ dlls in your
ASP.NET web application. Since these dlls may depend on C++Runtime. You are
wanting some infos on how to generate the access permission so as for those
unmanaged code to be executed properly.
If there is anything I misunderstood, please feel free to let me know.

Based on my research, generally in dotnet, when we need to use some unsafe
code in our application, but we don't want the caller application to have
such high permission. We'd like to use the "Wrapper Code":
here is the description on "Wrapper Code" in MSDN:
------------------------------
Wrapper code, especially where the wrapper has higher trust than code that
uses it, can open a unique set of security weaknesses. Anything done on
behalf of a caller, where the caller's limited permissions are not included
in the appropriate security check, is a potential weakness to be exploited.

Never enable something through the wrapper that the caller could not do
itself. This is a special danger when doing something that involves a
limited security check, as opposed to a full stack walk demand. When
single-level checks are involved, interposing the wrapper code between the
real caller and the API element in question can easily cause the security
check to succeed when it should not, thereby weakening security.
--------------------------------
For more detailed info on secure code in dotnet , you can visit the
following link in MSDN:
#Secure Coding Guidelines
http://msdn.microsoft.com/library/en...recodingguidel
ines.asp?frame= true

As for the situation you described, I think you may first write a wrapper
class to encapsulate those unamanged dlls's functions. This wrapper class
could be a C# or VB.NET assemblies or Managed C++ Asseblies. And then, call
this wrapper component in ASP.NET , thus can make the ASP.NET less strict
on code access security.

Also, as for the "Add the security for IUSR_<system name> to the System32
directory" you mentioned. This only add the permission for the IUSR_<system
name> to access the system32 directory. In fact, by default the ASP.NET's
worker process will run under the MACHINE\ASPNET account , and the code it
executed and resources accessed will use this account to check the
permission. For more information on the ASP.NET security model, you can
have a look at the following tech articles:
http://msdn.microsoft.com/library/en...et.asp?frame=t
rue

http://msdn.microsoft.com/library/en...03.asp?frame=t
rue

So based on different condition, the account under which ASP.NET process is
executed will be different, you need to set the permission for the
appropriate account in different situations.
In addition, I've searched some problems which may occur when called
Managed or Unmanaged C++ components
in ASP.NET, you may also have a check to see whether it helps:

#BUG: AppDomainUnload ed Exception When You Use Managed Extensions for C++
Components
http://support.microsoft.com/default...b;en-us;309694
Please check out the above items. If you have need any assistance, please
feel free to let me know.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2
Hi James,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, you'd like to use some older c++ dlls in your
ASP.NET web application. Since these dlls may depend on C++Runtime. You are
wanting some infos on how to generate the access permission so as for those
unmanaged code to be executed properly.
If there is anything I misunderstood, please feel free to let me know.

Based on my research, generally in dotnet, when we need to use some unsafe
code in our application, but we don't want the caller application to have
such high permission. We'd like to use the "Wrapper Code":
here is the description on "Wrapper Code" in MSDN:
------------------------------
Wrapper code, especially where the wrapper has higher trust than code that
uses it, can open a unique set of security weaknesses. Anything done on
behalf of a caller, where the caller's limited permissions are not included
in the appropriate security check, is a potential weakness to be exploited.

Never enable something through the wrapper that the caller could not do
itself. This is a special danger when doing something that involves a
limited security check, as opposed to a full stack walk demand. When
single-level checks are involved, interposing the wrapper code between the
real caller and the API element in question can easily cause the security
check to succeed when it should not, thereby weakening security.
--------------------------------
For more detailed info on secure code in dotnet , you can visit the
following link in MSDN:
#Secure Coding Guidelines
http://msdn.microsoft.com/library/en...recodingguidel
ines.asp?frame= true

As for the situation you described, I think you may first write a wrapper
class to encapsulate those unamanged dlls's functions. This wrapper class
could be a C# or VB.NET assemblies or Managed C++ Asseblies. And then, call
this wrapper component in ASP.NET , thus can make the ASP.NET less strict
on code access security.

Also, as for the "Add the security for IUSR_<system name> to the System32
directory" you mentioned. This only add the permission for the IUSR_<system
name> to access the system32 directory. In fact, by default the ASP.NET's
worker process will run under the MACHINE\ASPNET account , and the code it
executed and resources accessed will use this account to check the
permission. For more information on the ASP.NET security model, you can
have a look at the following tech articles:
http://msdn.microsoft.com/library/en...et.asp?frame=t
rue

http://msdn.microsoft.com/library/en...03.asp?frame=t
rue

So based on different condition, the account under which ASP.NET process is
executed will be different, you need to set the permission for the
appropriate account in different situations.
In addition, I've searched some problems which may occur when called
Managed or Unmanaged C++ components
in ASP.NET, you may also have a check to see whether it helps:

#BUG: AppDomainUnload ed Exception When You Use Managed Extensions for C++
Components
http://support.microsoft.com/default...b;en-us;309694
Please check out the above items. If you have need any assistance, please
feel free to let me know.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
Hi James,
Have you had a chance to check out my suggestion in last reply? If you have
any questions or need any help, please
feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4

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

Similar topics

5
3198
by: Markus Stehle | last post by:
Hi all! I have asp.net web application that uses static impersonation. Is it possible to change the impersonated user during runtime? Within some parts of my application I would like to impersonate another user in order to access certain ressources and then switch back to the originally impersonated user. How can I do this? Thanks
0
1760
by: Brian Takita | last post by:
Hello, I'm getting the following error at the end of this message when trying to run the ReportManager and the ReportServer: Assembly system.data.dll security permission grant set is incompatible between appdomains. I had to apply KB 887787 (http://support.microsoft.com/?kbid=887787) to fix my previous error, which stated... Assembly microsoft.web.validatepathmodule.dll security permission grant
2
2201
by: Michael Tissington | last post by:
I have converted an application to asp.net 2.0. a C# file in my App_Code folder calls a C++ DLL that is in my BIN folder. In the previous version of .NET this worked correctly. However in a hosted environment I'm now getting a a security error when I try to call the external dll. --- Security Exception
10
6101
by: Lauren Wilson | last post by:
I have a desperate short term need for a way to install Access 2003 runtime on client computers. I have the proper license to do so but I cannot seem to find the files to do it like we did with the old Access 2000 Runtime. Also, I cannot use the MS Package & Deployment wizard because it won't allow us to install our app into the specific path that it must be in. It only seems to allow preset macros to define the target install path --...
4
2070
by: kristan.mcdonald | last post by:
Probably a simple one, but I've found nothing in groups or google so here goes; trying to deploy a simple .net asp app to our web server, which has been hardended as it's public facing. It's only ever run classic asp apps before. I've tried to upload a basic app with nothing but an empty web form, and I get the default "Runtime error, The custom error settings prevent you blah" I've tried setting customErrors but I get the same page,...
1
2115
by: kito | last post by:
Hi, I have a problem, when I want to access to my SQL Server Express database from my ASP.NET application. My workstation ID is KITOLAP-HP My username is user01 Now I built the following connection String (VB.NET): Dim workstation As String = System.Environment.GetEnvironmentVariable("computername") connectionString = "workstation id=""" & workstation & """;packet
27
1839
by: HKSHK | last post by:
Hello, I have this problem: I wrote some DLLs with VB.Net 2003 which I use with my programs. But I want to avoid that I have to go down to "DLL hell" and to copy all used dlls into each program directory. Does anyone have an idea how I can avoid that? Thanks in advance!
9
3799
by: Andreas Schmitt | last post by:
I am workin on a 2 part project right now. The first part is a DLL, the second part a normal exe using that DLL. When I use the VS2005 standard setting for compiling with the Multithreaded-DLL runtime library (compiler option /MD )everything works fine on my PC. But when I try to run the thing on a friends PC or my laptop I get: "This application has failed to start because the application configuration is incorrect.
0
2091
by: Steve | last post by:
Hello- Platform: - web server using IIS 6 connecting to UNC share on separate file server - Both servers are Windows 2003 with dotNetFramework 2.0 General: - basic ASP.NET pages work fine in this situation
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.