Security Violation in my Web Service

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Re: Security Violation in my Web Service

    Is impersonation enabled in the web server? If so, those credentials would
    be use to access the file, not the ASPNET account.

    The FileIOPermission stuff won't help with an UnauthorizedAccessException as
    the UnauthorizedAccessException is caused by Windows security and the
    FileIOPermission is for CAS.

    Joe K.

    "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    news:475FF115-5D6A-47CA-B92C-4FBC88B7B6DD@microsoft.com...
    > I've written a ASP .NET WEB Service that tries to load a xml document from
    the file system and receive the following exception:
    >
    > Additional information: System.Web.Services.Protocols.SoapException:
    Server was unable to process request. --->
    System.UnauthorizedAccessException: Access to the path
    'c:\inetpub\wwwroot\AssuredOffice\policies\{420B28 30-E718-11CF-893D-00A0C905
    4228}Policy.xml' is denied
    >
    > I've included the following in the AssemblyInfo.cs
    >
    > [assembly: FileIOPermission(SecurityAction.RequestMinimum,
    All=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    >
    > I've also tried putting this attribute on the method that tries to load
    the xml document
    >
    > [FileIOPermission(SecurityAction.Assert,
    Read=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    >
    >
    > I've checked the ACl on the file and directory to ensure that the ASPNET
    account has read access -- what I'm I missing?
    >

    Joe Kaplan \(MVP - ADSI\) Guest

  2. Similar Questions and Discussions

    1. Web service security
      Hello I am new to web services and I have a number of questions. I have read the WSE documentation and various other articles, but I am not sure...
    2. Web Service and Application Security
      My application software is deployed across two tiers; a WinForms workstation client and a Web Services layer. My application will require...
    3. Web Service Security?
      I have created a Windows app in C# which makes a call to a dll created in C# and to a Web Service, also created in C#. I have put the exe along...
    4. Security Sandbox Violation?
      When I go to any page on yahoo.com, I get this window pop up with this text. What is going on? And how do you stop this from happening? (I'm using...
    5. Web Service Security problem
      Hello. I'm still struggling with a million new concepts in this .NET world, so forgive me if the answers are obvious. I wrote a test web service...
  3. #2

    Default Re: Security Violation in my Web Service

    Oh well, so much for the easy answer.

    There is definitely a Windows security authorization problem here. I'd
    enable auditing for object access in your local security policy and set the
    SACL on the file to enable auditing. Then, you should at least get an audit
    failure in the security event log saying who tried to access the file and
    why it failed.

    You might also try using Filemon from sysinternals to see this.

    Joe K.

    "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    news:93F5797E-5DE5-40F9-A489-76E7A14ECCD5@microsoft.com...
    > No, impersonation is not enabled.
    >
    > "Joe Kaplan (MVP - ADSI)" wrote:
    >
    > > Is impersonation enabled in the web server? If so, those credentials
    would
    > > be use to access the file, not the ASPNET account.
    > >
    > > The FileIOPermission stuff won't help with an
    UnauthorizedAccessException as
    > > the UnauthorizedAccessException is caused by Windows security and the
    > > FileIOPermission is for CAS.
    > >
    > > Joe K.
    > >
    > > "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    > > news:475FF115-5D6A-47CA-B92C-4FBC88B7B6DD@microsoft.com...
    > > > I've written a ASP .NET WEB Service that tries to load a xml document
    from
    > > the file system and receive the following exception:
    > > >
    > > > Additional information: System.Web.Services.Protocols.SoapException:
    > > Server was unable to process request. --->
    > > System.UnauthorizedAccessException: Access to the path
    > >
    'c:\inetpub\wwwroot\AssuredOffice\policies\{420B28 30-E718-11CF-893D-00A0C905
    > > 4228}Policy.xml' is denied
    > > >
    > > > I've included the following in the AssemblyInfo.cs
    > > >
    > > > [assembly: FileIOPermission(SecurityAction.RequestMinimum,
    > > All=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    > > >
    > > > I've also tried putting this attribute on the method that tries to
    load
    > > the xml document
    > > >
    > > > [FileIOPermission(SecurityAction.Assert,
    > > Read=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    > > >
    > > >
    > > > I've checked the ACl on the file and directory to ensure that the
    ASPNET
    > > account has read access -- what I'm I missing?
    > > >
    > >
    > >
    > >

    Joe Kaplan \(MVP - ADSI\) Guest

  4. #3

    Default Re: Security Violation in my Web Service

    Thanks Joe. Great suggestion. The ASPNET (ASP Machine Account) is accessing the componet, as expected. The real problem was in how the XML file was being loaded. It was being loaded through a FileStream with FileMode.Open which requires more than just Read access.

    "Joe Kaplan (MVP - ADSI)" wrote:
    > Oh well, so much for the easy answer.
    >
    > There is definitely a Windows security authorization problem here. I'd
    > enable auditing for object access in your local security policy and set the
    > SACL on the file to enable auditing. Then, you should at least get an audit
    > failure in the security event log saying who tried to access the file and
    > why it failed.
    >
    > You might also try using Filemon from sysinternals to see this.
    >
    > Joe K.
    >
    > "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    > news:93F5797E-5DE5-40F9-A489-76E7A14ECCD5@microsoft.com...
    > > No, impersonation is not enabled.
    > >
    > > "Joe Kaplan (MVP - ADSI)" wrote:
    > >
    > > > Is impersonation enabled in the web server? If so, those credentials
    > would
    > > > be use to access the file, not the ASPNET account.
    > > >
    > > > The FileIOPermission stuff won't help with an
    > UnauthorizedAccessException as
    > > > the UnauthorizedAccessException is caused by Windows security and the
    > > > FileIOPermission is for CAS.
    > > >
    > > > Joe K.
    > > >
    > > > "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    > > > news:475FF115-5D6A-47CA-B92C-4FBC88B7B6DD@microsoft.com...
    > > > > I've written a ASP .NET WEB Service that tries to load a xml document
    > from
    > > > the file system and receive the following exception:
    > > > >
    > > > > Additional information: System.Web.Services.Protocols.SoapException:
    > > > Server was unable to process request. --->
    > > > System.UnauthorizedAccessException: Access to the path
    > > >
    > 'c:\inetpub\wwwroot\AssuredOffice\policies\{420B28 30-E718-11CF-893D-00A0C905
    > > > 4228}Policy.xml' is denied
    > > > >
    > > > > I've included the following in the AssemblyInfo.cs
    > > > >
    > > > > [assembly: FileIOPermission(SecurityAction.RequestMinimum,
    > > > All=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    > > > >
    > > > > I've also tried putting this attribute on the method that tries to
    > load
    > > > the xml document
    > > > >
    > > > > [FileIOPermission(SecurityAction.Assert,
    > > > Read=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    > > > >
    > > > >
    > > > > I've checked the ACl on the file and directory to ensure that the
    > ASPNET
    > > > account has read access -- what I'm I missing?
    > > > >
    > > >
    > > >
    > > >
    >
    >
    >
    jbothwel Guest

  5. #4

    Default Re: Security Violation in my Web Service

    Glad that worked. I wouldn't have thought to ask about the details on the
    file stream.

    Joe K.

    "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    news:C7E4C193-5F99-4245-B1E5-85A4240AC42E@microsoft.com...
    > Thanks Joe. Great suggestion. The ASPNET (ASP Machine Account) is
    accessing the componet, as expected. The real problem was in how the XML
    file was being loaded. It was being loaded through a FileStream with
    FileMode.Open which requires more than just Read access.
    >
    > "Joe Kaplan (MVP - ADSI)" wrote:
    >
    > > Oh well, so much for the easy answer.
    > >
    > > There is definitely a Windows security authorization problem here. I'd
    > > enable auditing for object access in your local security policy and set
    the
    > > SACL on the file to enable auditing. Then, you should at least get an
    audit
    > > failure in the security event log saying who tried to access the file
    and
    > > why it failed.
    > >
    > > You might also try using Filemon from sysinternals to see this.
    > >
    > > Joe K.
    > >
    > > "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    > > news:93F5797E-5DE5-40F9-A489-76E7A14ECCD5@microsoft.com...
    > > > No, impersonation is not enabled.
    > > >
    > > > "Joe Kaplan (MVP - ADSI)" wrote:
    > > >
    > > > > Is impersonation enabled in the web server? If so, those
    credentials
    > > would
    > > > > be use to access the file, not the ASPNET account.
    > > > >
    > > > > The FileIOPermission stuff won't help with an
    > > UnauthorizedAccessException as
    > > > > the UnauthorizedAccessException is caused by Windows security and
    the
    > > > > FileIOPermission is for CAS.
    > > > >
    > > > > Joe K.
    > > > >
    > > > > "jbothwel" <jbothwel@discussions.microsoft.com> wrote in message
    > > > > news:475FF115-5D6A-47CA-B92C-4FBC88B7B6DD@microsoft.com...
    > > > > > I've written a ASP .NET WEB Service that tries to load a xml
    document
    > > from
    > > > > the file system and receive the following exception:
    > > > > >
    > > > > > Additional information:
    System.Web.Services.Protocols.SoapException:
    > > > > Server was unable to process request. --->
    > > > > System.UnauthorizedAccessException: Access to the path
    > > > >
    > >
    'c:\inetpub\wwwroot\AssuredOffice\policies\{420B28 30-E718-11CF-893D-00A0C905
    > > > > 4228}Policy.xml' is denied
    > > > > >
    > > > > > I've included the following in the AssemblyInfo.cs
    > > > > >
    > > > > > [assembly: FileIOPermission(SecurityAction.RequestMinimum,
    > > > > All=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    > > > > >
    > > > > > I've also tried putting this attribute on the method that tries to
    > > load
    > > > > the xml document
    > > > > >
    > > > > > [FileIOPermission(SecurityAction.Assert,
    > > > > Read=@"C:\Inetpub\wwwroot\AssuredOffice\Policies")]
    > > > > >
    > > > > >
    > > > > > I've checked the ACl on the file and directory to ensure that the
    > > ASPNET
    > > > > account has read access -- what I'm I missing?
    > > > > >
    > > > >
    > > > >
    > > > >
    > >
    > >
    > >

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139