Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7925351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:15:37+00:00 2026-06-03T18:15:37+00:00

So I am using connection strings in my web.config using SQL authentication. Of course

  • 0

So I am using connection strings in my web.config using SQL authentication.

Of course people say this could be a vulnerability as you are storing password in plaintext.

However, from what I know, IIS never serves web.config, and web.config should only have read access to administrators and IIS anyway. So if the hacker has gained access to the webserver, then it won’t matter what encryption I use because the private key will be on the webserver.

Wouldn’t encrypting connection string be classified as security through obfuscation?

Is it worth encrypting web.config connection string and storing the private key on the webserver?

Further, of course if I don’t use SSL, I am transmitting connection string over HTTP in plaintext. If I use SSL then this problem should be mitigated as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:15:38+00:00Added an answer on June 3, 2026 at 6:15 pm

    I wouldn’t say that storing a plaintext password in Web.config is a security vulnerability, in and of itself. But encrypting the password is a useful defense-in-depth measure, not just security through obscurity:

    1. What if IIS is misconfigured to serve Web.config?
    2. What if a security vulnerability is discovered in ASP.NET (like the padding oracle vulnerability) that allows anyone to download Web.config?
    3. There are varying degrees of access to the Web server, from full administrative privileges to server-side code injection. If an attacker can only manage to do the latter, he might be able to read Web.config but might not be able to access the machine keys, especially if your application is running under partial trust.

    In the end, it’s up to you to decide if the risk of storing plaintext passwords in Web.config is acceptable. Of course, if Windows authentication is an option, then you may want to consider using that instead of SQL authentication.

    UPDATE: When talking about security, it’s a good idea to identify the assets and the threats. In this case, the asset is sensitive data in the database (if the data is unimportant, then why bother protecting it with a password?), and the threat is the possibility of an attacker somehow gaining access to Web.config and thus the database as well. A possible mitigation is to encrypt the database password in Web.config.

    How much of a risk is it? Do we really have to plan for such an astronomically rare occurrence?

    This mitigation has already proved its worth once: when the ASP.NET padding oracle vulnerability was discovered. Anyone who stored a plaintext password in Web.config was at risk; anyone who encrypted the password wasn’t. How certain are you that another similar vulnerability in ASP.NET won’t be discovered in the next few years?

    Should we also encrypt source code and decrypt on run-time? Seems excessive to me.

    So what if an attacker does get access to your source code? What’s the asset you’re protecting, and what’s the threat you’re concerned about? I think that in many cases, source code is much less valuable than data. (I’m thinking here about off-the-shelf commercial and open-source software which anyone can obtain.) And if your source code is valuable, maybe obfuscation is something to think about.

    I feel if they already have even limited access to your box, then your host has failed or you’ve installed vulnerable services already.

    What about security vulnerabilities in ASP.NET or your code? They do pop up from time to time.

    My concern is standard practices. Is it a standard?

    Microsoft has recommended encrypting connection strings.

    What you should do is evaluate the risk that storing a plaintext password poses:

    • How likely is it that an attacker will be able to discover and exploit a security vulnerability that exposes Web.config? Based on past history, I’d say the likelihood is low (but not “astronomically” low).
    • How valuable or sensitive is your data? If all you’re storing is pictures of your cat, then maybe it doesn’t matter much whether an attacker gets your database password. But if you’re storing personally identifiable information, then from a legal standpoint, I’d say you should take all possible measures to secure your application, including encrypting your connection strings.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got 3 connectionstrings in web.config, and I used theirs like this: using (SqlConnection
I want to get connection string using app.config file this is my app.config file
I'm using this code to read the connection string from my app.config file but
I built this app with Web Developer Express 2010 using SQL Server Express 2008.
I've encrypted the connectionstring in my web.config file using the steps in the link
The excel spreadsheet is connecting to SQL server 2005 using the connection string below:
This is the connection string I am using. string connection = Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\CULVERT2.DBF;Extended Properties=dBASE
How can I change the connection string from nhibernate.config file using nant the problem
When using SQL Server Express 2005's User Instance feature with a connection string like
I've created a web enabled database using SQL Server 2005 to store the data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.