---
title: "CWE-541: Inclusion of Sensitive Information in an Include File"
url: https://radicalnotion.ai/cwe/cwe-541
type: cwe
description: "If an include file source is accessible, the file can contain usernames and passwords, as well as sensitive information pertaining to the application and system."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-541: Inclusion of Sensitive Information in an Include File

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

If an include file source is accessible, the file can contain usernames and passwords, as well as sensitive information pertaining to the application and system.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data | - |

## Potential mitigations

### Architecture and Design

Do not store sensitive information in include files.

### Architecture and Design, System Configuration

Protect include files from being exposed.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

## Demonstrative examples

### Example 1

The following code uses an include file to store database credentials:

Bad code:

```php
<?php
$dbName = 'usersDB';
$dbPassword = 'skjdh#67nkjd3$3$';
?>
```

Bad code:

```php
<?php
include('database.inc');
$db = connectToDB($dbName, $dbPassword);
$db.authenticateUser($username, $password);
?>
```

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-540](https://radicalnotion.ai/cwe/cwe-540) | Inclusion of Sensitive Information in Source Code |

## Frequently asked questions

### What is CWE-541?

If an include file source is accessible, the file can contain usernames and passwords, as well as sensitive information pertaining to the application and system.

### How do you prevent CWE-541?

Do not store sensitive information in include files.

### How is CWE-541 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-541?

Exploiting CWE-541 can lead to: Read Application Data.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/541.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-541). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
