Home > Articles > Security > Network Security

Web System Security

This chapter is from the book

3.3 Database Server

The storage of data and user-specific information by the Web system requires that safeguards be in place to protect this information. Database servers, although typically not directly visible to a client computer, must be secured as if the Web server has been compromised. Securing the site's database is not limited to the database host itself; any Web system components or other data retrieval mechanisms that operate on the data residing in the database must be properly designed and implemented to protect against database content attacks.

As discussed earlier in the chapter, all servers on the site's network must be properly secured from the operating system and commercial software perspectives. Any server can possibly be used to gain an administrative foothold on the network. This, of course, applies to the database server as well. User accounts, file systems, and server software running on the database server must be properly configured to prevent unauthorized access by an intruder. This section assumes that the computer on which the database is running—either standalone or colocated with the Web server—has been properly secured from the perspective of user accounts, file systems, and server software.

This section focuses on the following aspects of securing the site's database:

  • Database overview. Some of the more common ways that databases are implemented for Web systems are described.

  • Security of content stored in the database. Properly securing sensitive data stored in an Internet-accessible database is possibly the most important security concern for a Web system. As suggested throughout this chapter, one must assume that the servers supporting a Web system will be compromised. Depending on the knowledge level of the attacker, this compromise very possibly could include unauthorized access to data in the site's database. Another consideration is the temporary storage of private user data during processing, either before or after it is stored in the database, in plaintext files on a server's file system (Sullivan 2000).

  • Database access from the Web server. Web system components typically provide access to data stored in the Web site's database. With this access mechanism comes additional security concerns over the handling of database schema and connection information (Rahmel 1997).

Database Overview

In general, a database that supports a Web application can have three configurations:

  • A file-based database usually residing on the Web server machine. The Web system components use an API, such as Active Data Objects (ADO), to access the file directly. The file must be secured like any other in the file system, to prevent it from being downloaded, accessed, or manipulated by an intruder. Examples of this kind of database are Microsoft Access on Windows platforms and mySQL on UNIX platforms.

  • A mainstream relational database management system (RDBMS) such as Microsoft SQL Server or Oracle colocated with the Web server, meaning that it is on the same machine.

  • A mainstream RDBMS running on its own server and accessed over a network by the Web server machine. The addition of a second firewall between the Web server machine and the database machine make this the most secure configuration and is the most common one for large Web applications.

One of these general configurations will be selected and implemented for a Web system, based on defined system requirements and the available development budget. Although these three approaches are quite different from a deployment standpoint, they have several similar aspects that must be considered for proper security administration of the database and access to the data it contains.

Many Web systems will be set up to access the database as a single, privileged user, as it is generally easier to configure. It is easier to set up all the Web system components to connect to the database as the same user—with the same ID and password—rather than have several different users and maintain the ID and password in many different scripts.

Additionally, accessing the database as a single user can offer better performance on Microsoft Windows NT/2000 systems, because of connection pooling, which allows the operating system to keep database connections open even though they are not currently in use, by placing them into a "pool" of open, ready-to-use connections. As a result, the next time the program requires a connection, one is instantly provided from the pool, without the normal start-up overhead. This is worthwhile, as creating and opening the connection to the database can be expensive in terms of performance.

Security in this case is enforced at the Web server component level rather than at the database level. For example, a component will first make sure that the user who connected to the Web server has the appropriate level of access to perform a particular operation. After it is determined that the user is authorized to perform the action, the component will then access the database as a highly privileged user. If the component didn't perform this check, lower-level users could execute database operations outside their level of access. A single database user is also a bit more secure from the database perspective, as fewer users are defined in the database itself, which can be a potential source for intrusions.

Database Content

Data Privacy

Maintaining the confidentiality of Web system data must be a top priority, particularly for e-commerce systems. When customers make a purchase from an e-commerce site, they are placing a significant amount of trust in the Web system to safeguard their personal data and to ensure that this personal information will not be further distributed to external parties that could cause them harm, financially or otherwise. To this end, when dealing with sensitive user information, such as names, addresses, telephone numbers, and credit card numbers, the Web system's primary concern should be the privacy of the end user.

However, merchants are usually obligated to retain certain information after a payment transaction has been processed, for a period of time known as the dispute period. Because a customer may dispute a credit card charge for various reasons, including fraud, the merchant must be able to audit the transaction back to the payment information used during the transaction. Keep in mind that this type of payment transaction history is quite different from the storage of personal user data used to increase the user's experience of the Web site. Payment transaction history data is used for internal purposes by the merchant and should not be readily accessible by any means to an end user. In fact, it is recommended that transaction history information be stored in encrypted form in a separate, write-only database.

A Web site can facilitate the secure storage of payment transaction history data by creating a separate database, possibly on a separate server, for this purpose. The following steps demonstrate the configuration of a transaction history database on Microsoft SQL Server.

  1. Create a new database on the desired machine.

  2. Create a database user account that will be used by the components that need to store payment transaction history information, such as PaymentHistoryUser.

  3. Create a table (or tables if necessary) that will store the necessary pieces of information for the transaction history.

  4. Remove all permissions on this table from all database users and roles; in other words, do not allow select, insert, update, delete, or any other operations on this table to any users of the database, including PaymentHistoryUser.

  5. Create a stored procedure to insert the customer and payment information into the transaction history table. This stored procedure will be able to access the table even though the PaymentHistoryUser cannot directly access the table itself.

  6. Grant execute access on the stored procedure to the PaymentHistoryUser account.

  7. In the components that need to store transaction history information, invoke the stored procedure to insert the data into the table.

  8. As an added security measure, encrypt all information, as discussed in the next section, prior to passing it to the stored procedure.

The architecture depicted in Figure 3-7 ensures that the database containing the sensitive payment transaction history data will remain isolated from the rest of the Web site's data and will be less susceptible to attack, owing to the write-only nature of the database.

Figure 3-7 Write-Only Database for Payment Transaction History

Data Encryption

The safest way to avoid problems with unauthorized access to site data is to encrypt the data while it is stored in the database. When it must be accessed for processing, the data is read from the database and then decrypted in memory. Web system components can make use of certain operating system functions to encrypt important data prior to performing insertions or updates to the database.

Encryption of the data ensures that whenever an attacker finds a way to access the system database or, in the case of a file-based database, simply downloads it, the data will be unreadable.

For example, consider a customer service facility that allows customers to view their account information, including full names, addresses, and phone numbers. This sensitive information is encrypted and stored in a database table. When the system invokes a component to view user information, the component reads the encrypted data from the database, decrypts the data in memory, and forwards the data to the client computer over a secured HTTP (SSL) connection. In this way, the data cannot be viewed by hacking into the database—owing to the encryption on the stored data—or intercepted by a third party during transmission—owing to the secured connection.3

Encrypting/decrypting information on the fly can be performed with certain APIs available on most operating systems and through the use of some scripting languages:

  • CryptoAPI, available from Microsoft: a set of Win32-style API calls

  • The crypt function available on most UNIX systems

  • ::Crypt modules for Perl scripts

These APIs require the use of an encryption key, which is used as the basis for encrypting the data. Deciding where to store the key, however, is a somewhat complicated issue. If an intruder manages to get the encryption key, the data in the database will then be compromised. For some Web systems, storing the key in a compiled, binary component is enough, relying on the fact that the key is somewhat hidden since it is not easily viewable. However, the reality is that a knowledgeable intruder will probably be able to extract the key from a binary component, thus rendering this approach useless. Unfortunately, there is no absolute solution to this problem, only somewhat stronger alternatives:

  • Store the key in a file and rely on operating system security to protect the contents of the file, meaning, only give read permission on this file to the user identity that the Web system server components execute under. If the server is properly secured, this file should not be accessible by other users—including intruders—with access to the server's file system.

  • Create a binary component that programmatically creates the encryption key, rather than storing it as a string in source code. This will make it impossible for the encryption key to be discovered by simply dumping the strings from the binary component.

Temporary and Log Files

Encrypting the data stored in the database is a critical step in securing private user data. However, Web system components accessing this data may inadvertently place the unencrypted form of this data into a temporary file or a log file on the Web server's disk. This can happen either before the data is encrypted and stored in the database or after the data is retrieved from the database and decrypted. The latter case may not occur until long after the user has departed, such as in after-hours batch processing or reports. Because the temporary and log files are often stored in obscure directories, they can remain unnoticed from a security perspective. If the directories containing temporary and log files are not tightly controlled and maintained, an unauthorized user may gain access to them. Log file entries should not include sensitive data. Because some third-party applications may also log data, it is important to inspect all third-party software logging functionality to ensure that sensitive data is not logged.

In most cases, it is better to avoid the use of temporary files in a Web system. From a security perspective, it is not sufficient to assume that Web system components will remove temporary files after they are finished using them. A Web system component may crash, either inadvertently or maliciously when manipulated by an attacker, leaving the temporary file "orphaned" on the server's file system. Another possibility is that the temporary file may be accessed by an attacker at the same time that it is being used by the Web system component: a race condition. Because of these problems, avoid the use of temporary files from Web system components. When the use of a temporary file cannot be avoided, make sure that sensitive data placed in a temporary file is encrypted. If the encryption of the data in the temporary file is not possible, consider an alternative approach to processing the data that does not involve the use of temporary files.

Access to Database Objects

As described earlier, many Web systems make use of a single log-on technique for accessing data stored in the database. The reasons for using a single log-on technique are ease of administration—no need to add accounts for each user—better performance—connections can be reused—and simplicity—less work to determine which credentials to use. Web systems that use a single log-on technique typically enforce access control at the "boundaries" of the system, meaning that the Web system components verify that the user has permission to access the specified content.

Although the system's components are performing access checks prior to accessing the database, it should not be assumed that the data in the database can be left wide open, accessible to any database user. Access to tables, views, and other database objects should be granted only to the privileged Web access account(s) and should not be viewable to other database users, when they exist.

Database Access

Web system components access the database through an API such as ODBC (Open Database Connectivity), JDBC (Java Database Connectivity), or ADO. In order to interact with the database through such APIs, the back-end components must be able to connect to the database as users and to construct queries against tables and other objects in the database. Two security concerns arise from this situation.

Database User ID and Password

Web system components need to be able to connect to the database and typically have a predetermined user ID and password hard coded in their source code or possibly even in a configuration file. This is largely because of the widespread use of the single database user approach, as outlined earlier. It is important to secure the user ID and password information so that it cannot be retrieved by an intruder and then used to access the database.

Note that the discussion presented applies only to architectures that store a text user ID and password for connecting to the database from the Web system components. Some architectures, such as one that makes use of Microsoft's IIS and SQL Server, can use an integrated security technique, whereby the database connection information is not stored in the component but instead is taken from the identity of the Web server process or the user connecting to the Web server.

In nonintegrated security Web architectures, the user ID and password data can be stored for later use in several ways. The login data may be placed directly into the script or component source code and used when needed.

Alternatively, components may store the password outside of the executable files or scripts, within a configuration file or within the registry on Windows NT/2000 machines. Because components need the database user ID and password in order to establish connection with the database, the storage of this information for ready access by a component is a necessity. Care must be taken, however, to store the data for back-end components and, through encryption, still make it difficult for an intruder to access the login data, if an intruder is able to gain access to the system.

One approach is to store the user ID and password outside the component source code through the use of a configuration file, and rely on operating system security on the file to keep the information safe. If the configuration file is compromised, however, the user ID and password information are easily viewable.

Another approach is to store the user ID and a password in component source code, in a configuration file, in the registry, in an encrypted form. For a further discussion on encryption techniques, refer to the "Data Encryption" section earlier in this chapter.

Database Schema Information

In order to access data from the system database, Web system components will need to possess knowledge of the database schema: database, table and column names, data types, and so on. Schema information is used to build queries against the database, such as retrieving and updating records.

At times, it may seem beneficial for the Web system to store database schema information or even entire queries within hidden form fields on a Web page or in cookies, which are sent back to the server automatically when the user submits a form or accesses a different Web page. This practice, however, may expose the system's database to intrusion, allowing an attacker to learn the structure of the database and possibly to modify the database query to be able to operate against a different part of the database. Therefore, all database schema–related information must remain private to Web system components and should not be sent to the client browser.

A related issue is the storage of schema information or queries within HTML comments. Sometimes, this type of storage is used to support debugging and tracing, but doing so in a production environment needlessly exposes the system's database schema to unauthorized users.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020