<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Shimon Krokhmal's blog - Microsoft|IIS 6</title>
    <link>http://www.krokhmal.com/</link>
    <description>medium : .NET | JavaScript | Secure coding | Databases | Sql Server | Oracle | CodeSmith | SPS | Life</description>
    <language>en-us</language>
    <copyright>Shimon Krokhmal</copyright>
    <lastBuildDate>Tue, 29 Aug 2006 22:55:46 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>Shimonkr@gmail.com</managingEditor>
    <webMaster>Shimonkr@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.krokhmal.com/Trackback.aspx?guid=9cc2b159-a4b2-44f9-ab6f-0229b8aaf076</trackback:ping>
      <pingback:server>http://www.krokhmal.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.krokhmal.com/PermaLink,guid,9cc2b159-a4b2-44f9-ab6f-0229b8aaf076.aspx</pingback:target>
      <dc:creator>Shimon krokhmal</dc:creator>
      <wfw:comment>http://www.krokhmal.com/CommentView,guid,9cc2b159-a4b2-44f9-ab6f-0229b8aaf076.aspx</wfw:comment>
      <wfw:commentRss>http://www.krokhmal.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9cc2b159-a4b2-44f9-ab6f-0229b8aaf076</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the most important rules about running an application (specially web application)
is giving to the application <strong>only</strong> the needed permissions to run,
and no more ! (running a web application <strong>with an administrator user is bad</strong>....).<br />
Sure, it's very comfortable to give the application all the permissions that the system
has, and not trying to solve permission related problems directly,<br />
But this kind of an approach is a security-breach prone approach.<br />
suppose, you wrote an application that has a minor security hole in it, and it allows
the user to execute some unwanted script.<br />
If it will run in a full permissions context, than it would be very easy to hijack
the entire system, or even just do a system-wide damage.<br /><strong>But</strong>, if it will run only with the needed permission, then the attacker
would have a hard time doing it.
</p>
        <p>
So, what is the solution ?
</p>
        <p>
First, create a new application pool that will run the wanted web application ( if
you don't know how to do this , please refer to <a href="http://www.krokhmal.com/IIS6ApplicationPoolManagement.aspx">this</a> article
about <a href="http://www.krokhmal.com/IIS6ApplicationPoolManagement.aspx">application
pool management</a> ).
</p>
        <p>
once, you have created the app pool, lets create the user :
</p>
        <ul>
          <li>
enter to the computer management, click on the users folder and add a new user :<br /><img height="450" alt="AddUser.JPG" src="http://www.krokhmal.com/content/binary/AppUser/AddUser.JPG" width="539" border="0" /><br /></li>
          <li>
Set the user name and the password, and don't forget to check the "password never
expires" option ( we don't want the application will stop working after some XX days...)<br /><br /><img height="379" alt="CreateUser.JPG" src="http://www.krokhmal.com/content/binary/AppUser/CreateUser.JPG" width="385" border="0" /><br /><br /></li>
          <li>
confirm the pass<br /><img height="127" alt="ConfirmPass.JPG" src="http://www.krokhmal.com/content/binary/AppUser/ConfirmPass.JPG" width="321" border="0" /><br /><br /></li>
          <li>
now, this is a very important step, without this the application won't run.<br />
right click on the fresh added user -&gt; properties -&gt; click on the "Member of"
tab -&gt; Add the user to the IIS_WPG group, so it can run iis applications<br /><br /><img height="466" alt="SetToIISGroup.JPG" src="http://www.krokhmal.com/content/binary/AppUser/SetToIISGroup.JPG" width="404" border="0" /><br /><br /></li>
          <li>
Set the new user to run the application pool that we created before.<br /><br /><img height="435" alt="AppPoolIdentity.JPG" src="http://www.krokhmal.com/content/binary/AppUser/AppPoolIdentity.JPG" width="461" border="0" /><br /><br /></li>
          <li>
Do iisreset.( or just restart the application pool)</li>
        </ul>
        <p>
thats it.<br />
you did it, now your application runs under a limited user.<br />
the iis process will run now with the given user and not the admin.
</p>
        <p>
          <img height="553" alt="UserProccess.JPG" src="http://www.krokhmal.com/content/binary/AppUser/UserProccess.JPG" width="540" border="0" />
        </p>
        <p>
you just made another step to a more secured application.
</p>
        <img width="0" height="0" src="http://www.krokhmal.com/aggbug.ashx?id=9cc2b159-a4b2-44f9-ab6f-0229b8aaf076" />
        <br />
        <hr />
Shimon krokhmal, a part of the Krokhmal family</body>
      <title>IIS 6 - run with an application user</title>
      <guid isPermaLink="false">http://www.krokhmal.com/PermaLink,guid,9cc2b159-a4b2-44f9-ab6f-0229b8aaf076.aspx</guid>
      <link>http://www.krokhmal.com/2006/08/29/IIS6RunWithAnApplicationUser.aspx</link>
      <pubDate>Tue, 29 Aug 2006 22:55:46 GMT</pubDate>
      <description>&lt;p&gt;
One of the most important rules about running an application (specially web application)
is giving to the application &lt;strong&gt;only&lt;/strong&gt; the needed permissions to run,
and no more ! (running a web application &lt;strong&gt;with an administrator user is bad&lt;/strong&gt;....).&lt;br&gt;
Sure, it's very comfortable to give the application all the permissions that the system
has, and not trying to solve permission related problems directly,&lt;br&gt;
But this kind of an approach is a security-breach prone approach.&lt;br&gt;
suppose, you wrote an application that has a minor security hole in it, and it allows
the user to execute some unwanted script.&lt;br&gt;
If it will run in a full permissions context, than it would be very easy to hijack
the entire system, or even just do a system-wide damage.&lt;br&gt;
&lt;strong&gt;But&lt;/strong&gt;, if it will run only with the needed permission, then the attacker
would have a hard time doing it.
&lt;/p&gt;
&lt;p&gt;
So, what is the solution ?
&lt;/p&gt;
&lt;p&gt;
First, create a new application pool that will run the wanted web application ( if
you don't know how to do this , please refer to &lt;a href="http://www.krokhmal.com/IIS6ApplicationPoolManagement.aspx"&gt;this&lt;/a&gt;&amp;nbsp;article
about &lt;a href="http://www.krokhmal.com/IIS6ApplicationPoolManagement.aspx"&gt;application
pool management&lt;/a&gt;&amp;nbsp;).
&lt;/p&gt;
&lt;p&gt;
once, you have created the app pool, lets create the user :
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
enter to the computer management, click on the users folder and add a new user :&lt;br&gt;
&lt;img height=450 alt=AddUser.JPG src="http://www.krokhmal.com/content/binary/AppUser/AddUser.JPG" width=539 border=0&gt;
&lt;br&gt;
&lt;li&gt;
Set the user name and the password, and don't forget to check the "password never
expires" option ( we don't want the application will stop working after some XX days...)&lt;br&gt;
&lt;br&gt;
&lt;img height=379 alt=CreateUser.JPG src="http://www.krokhmal.com/content/binary/AppUser/CreateUser.JPG" width=385 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
confirm the pass&lt;br&gt;
&lt;img height=127 alt=ConfirmPass.JPG src="http://www.krokhmal.com/content/binary/AppUser/ConfirmPass.JPG" width=321 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
now, this is a very important step, without this the application won't run.&lt;br&gt;
right click on the fresh added user -&amp;gt; properties -&amp;gt; click on the "Member of"
tab -&amp;gt; Add the user to the IIS_WPG group, so it can run iis applications&lt;br&gt;
&lt;br&gt;
&lt;img height=466 alt=SetToIISGroup.JPG src="http://www.krokhmal.com/content/binary/AppUser/SetToIISGroup.JPG" width=404 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
Set the new user to run the application pool that we created before.&lt;br&gt;
&lt;br&gt;
&lt;img height=435 alt=AppPoolIdentity.JPG src="http://www.krokhmal.com/content/binary/AppUser/AppPoolIdentity.JPG" width=461 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
Do iisreset.( or just restart the application pool)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
thats it.&lt;br&gt;
you did it, now your application runs under a limited user.&lt;br&gt;
the iis process will run now with the given user and not the admin.
&lt;/p&gt;
&lt;p&gt;
&lt;img height=553 alt=UserProccess.JPG src="http://www.krokhmal.com/content/binary/AppUser/UserProccess.JPG" width=540 border=0&gt;
&lt;/p&gt;
&lt;p&gt;
you just made another step to a more secured application.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.krokhmal.com/aggbug.ashx?id=9cc2b159-a4b2-44f9-ab6f-0229b8aaf076" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Shimon krokhmal, a part of the Krokhmal family</description>
      <comments>http://www.krokhmal.com/CommentView,guid,9cc2b159-a4b2-44f9-ab6f-0229b8aaf076.aspx</comments>
      <category>Microsoft</category>
      <category>Microsoft/IIS 6</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://www.krokhmal.com/Trackback.aspx?guid=3c0da720-cf04-42b2-ae06-93e43ae222ff</trackback:ping>
      <pingback:server>http://www.krokhmal.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.krokhmal.com/PermaLink,guid,3c0da720-cf04-42b2-ae06-93e43ae222ff.aspx</pingback:target>
      <dc:creator>Shimon krokhmal</dc:creator>
      <wfw:comment>http://www.krokhmal.com/CommentView,guid,3c0da720-cf04-42b2-ae06-93e43ae222ff.aspx</wfw:comment>
      <wfw:commentRss>http://www.krokhmal.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3c0da720-cf04-42b2-ae06-93e43ae222ff</wfw:commentRss>
      <title>IIS 6 Application pool management</title>
      <guid isPermaLink="false">http://www.krokhmal.com/PermaLink,guid,3c0da720-cf04-42b2-ae06-93e43ae222ff.aspx</guid>
      <link>http://www.krokhmal.com/2006/08/24/IIS6ApplicationPoolManagement.aspx</link>
      <pubDate>Thu, 24 Aug 2006 19:31:07 GMT</pubDate>
      <description>&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;Ever encountered on a situation
that you have several Web Applications that works fine on the IIS 6 machine, 
&lt;br&gt;
and then you add another application to join the party, and all the server crashes/
not responding / running very slow?&lt;br&gt;
&lt;br&gt;
The answer is probably because the additional application that you added is a resource
hog, and it doesn't leave the other web application any resources at all.&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
&lt;o:p&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;So, what can we do?&lt;br&gt;
One of the solutions if code refectory or maybe an application redesign, 
&lt;br&gt;
but it not always works or even possible (some exponential algorithms and those sort
of stuff) 
&lt;br&gt;
&lt;br&gt;
the other solution is to limit your application with the IIS 6 configuration.&lt;br&gt;
How do we do it?&lt;/font&gt;
&lt;/p&gt;
&lt;ul type=1&gt;
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;start the IIS manager by clicking
: Start -&amp;gt; Run -&amp;gt; inetmgr&lt;/font&gt; 
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;Expand the wanted server&lt;/font&gt; 
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;Right Click on the "Application
Pools" directory, new-&amp;gt; Application pool.&lt;br&gt;
&lt;img height=465 alt="Creating the new Application pool" src="http://www.krokhmal.com/Blog/content/binary/NewAppPool.JPG" width=659 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt; 
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;type the wanted application pool
name in the appeared box and click OK&lt;br&gt;
&lt;br&gt;
&lt;img title="Create the application pool" height=216 alt=NewAppDialog.JPG src="http://www.krokhmal.com/Blog/content/binary/NewAppDialog.JPG" width=396 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt; 
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;Go to the websites directory, right
click on the wanted site, and choose properties&lt;/font&gt; 
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;Select the new created Application
pool from the combo box&lt;br&gt;
&lt;br&gt;
&lt;img title="Set the Application pool to the Web site" height=440 alt="Set the Application pool to the Web site" src="http://www.krokhmal.com/Blog/content/binary/SetAppPool.JPG" width=472 border=0&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt; 
&lt;li class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;Go back to the Application pool
directory, right click on our AppPool -&amp;gt; properties&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;o:p&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;&amp;nbsp;Go to the performance tab,&lt;br&gt;
here we start all the fun stuff. :&lt;br&gt;
&lt;img height=435 alt=AppSettings.JPG src="http://www.krokhmal.com/Blog/content/binary/AppSettings.JPG" width=461 border=0&gt;
&lt;br&gt;
&lt;br&gt;
* Check the "Enable CPU monitoring" option.&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;o:p&gt;
&lt;font face="Times New Roman" color=#000000 size=3&gt;* Set the maximum wanted percentage
of CPU usage&lt;br&gt;
* Choose the wanted action that you want to perform in case the application exceeds
the given limitations&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; DIRECTION: ltr; unicode-bidi: embed; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;p&gt;
thats it, you are set to go.&lt;br&gt;
now the new Web application is set to run under her own application pool which is
limited to his own limits.
&lt;/p&gt;
&lt;p&gt;
have fun.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.krokhmal.com/aggbug.ashx?id=3c0da720-cf04-42b2-ae06-93e43ae222ff" /&gt;
&lt;br /&gt;
&lt;hr /&gt;Shimon krokhmal, a part of the Krokhmal family</description>
      <comments>http://www.krokhmal.com/CommentView,guid,3c0da720-cf04-42b2-ae06-93e43ae222ff.aspx</comments>
      <category>Microsoft</category>
      <category>Microsoft/IIS 6</category>
    </item>
  </channel>
</rss>