Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


ASP.Net Debug vulnerability preventing PCI Compliance HELP!

Posted on 2013-12-30
Medium Priority
Last Modified: 2014-01-07
Our PCI Compliance vendor is failing our scans saying that we have ASP.Net Debugging enabled and that scanning results in an "HTTP Status Code 200 OK" rather than the expected 400 Bad Request, 405 Method Not Allowed, or 501 Not Implemented message.

I have gone through and modified the Machine.Config files to add the <deployment retail="true"/> line as specified in but they are still saying that a Status 200 OK is being returned.

The PCI vendor reference me to;en-us;815157 but it clearly says that disabling debugging using the machine.config file overrides debugging enabled in individual web.config files.

We are trying to avoid having to set this configuration in our 200 or so web.config files of which many are different. Has anyone dealt with this or have any insight to he me with this? Is this a known issue with disabling debugging using the retail mode method in the machine.config file?
Question by:AIC-Admin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39746551
We are trying to avoid having to set this configuration in our 200 or so web.config files
Well why are you deploying production code with the debug flag enabled? It's called "debug" for a reason.

The web.config files are just XML files. It really wouldn't be that hard to script or write a quick app to traverse all of your directories and remove debugging from each file.

Author Comment

ID: 39746647
I do not develop the websites (I'm just the network admin) but I was told by our lead developer that when they deploy code from development to production that they frequently deploy new web.config files. We run ASP.Net version 2 in 32-bit and 64-bit and ASP.Net version 4 in 32-bit and 64-bit. We have numerous web applications as well so we could end up with hundreds of web.config files across our 14 or so app servers.

I will see if our developers can or know how to do what you recommended... write a script or quick app to traverse all of our directories and remove debugging from each file. I assume that would consist of searching for all files named "web.config" then searching the contents of those files for <compilation debug="true"/> and if found changing it to "<compilation debug="false"/>.
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39747302
LVL 75

Accepted Solution

käµfm³d   👽 earned 1500 total points
ID: 39747383
You can try the following VBScript file if you like. Copy the code into a new text file, and give it a ".vbs" extension. Then you can simply double-click the new file to run it.

You would need to change the first to lines to something more appropriate--change what's inside the quotes, nothing else. The code will copy the original web.config files--maintaining their hierarchy as found in the source folder--to a backup folder before modifying them. Then you can compare to see which files were modified, or restore any that you may need.

If you do decide to use this, MAKE A BACKUP OF YOUR SOURCE FOLDER FIRST! I don't foresee any issue with this code, but it's better to be safe than sorry.

'WWWROOT = "C:\path\to\your\site\top\level\folder"
'BACKDIR = "C:\path\to\a\folder\where\you'll\copy\backups"

' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  Script Start
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set FSO = CreateObject("Scripting.FileSystemObject")
Set ROOT = fso.GetFolder(WWWROOT)

If Not fso.FolderExists(BACKDIR) Then
End If

Set BACK = fso.GetFolder(BACKDIR)

Call ProcessFolder(ROOT, BACK)

' ######################################
'  Functions
' ######################################

Sub ProcessFolder(ByVal target, ByVal backup)
    For Each file in target.Files
        Call ProcessFile(file, backup)

    For Each fold In target.SubFolders
        backFoldPath = backup.Path & "\" & fold.Name
        If Not FSO.FolderExists(backFoldPath) Then
        End If
        Set backFold = FSO.GetFolder(backFoldPath)
        Call ProcessFolder(fold, backFold)
End Sub

Sub ProcessFile(ByVal target, ByVal backup)
    FSO.CopyFile target.Path, backup.Path & "\" & target.Name

    Set xdoc = CreateObject("Msxml2.DOMDocument.6.0")
    xdoc.Load target.Path
    Set compilationNode = xdoc.SelectSingleNode("/configuration/system.web/compilation")
    If Not compilationNode Is Nothing Then
    End If
End Sub

Open in new window


Author Closing Comment

ID: 39762111
Thank you for providing this code! I will keep this for future use.

We ended up writing an "iRule" on our F5 Load Balancer to identify inbound DEBUG requests and automatically reply with a "http 403 forbidden" response which has resolved the issue.

Featured Post

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as high-speed processing of the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Check out what's been happening in the Experts Exchange community.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question