# GHSA-7mc6-x925-7qvx: Test code in published microsoft-graph-beta package exposes phpinfo()

> Published test code exposes phpinfo() if vendor directory is web-accessible, allowing attackers to read system configuration and secrets.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 5 Dec 2023

## What is GHSA-7mc6-x925-7qvx?

GHSA-7mc6-x925-7qvx is a vulnerability in microsoft/microsoft-graph-beta, published on 5 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

The Microsoft Graph Beta PHP SDK published packages which contained test code that enabled the use of the phpInfo() function from any application that could access and execute the file at vendor/microsoft/microsoft-graph-beta/tests/GetPhpInfo.php.  The phpInfo function exposes system information. 

The vulnerability affects the GetPhpInfo.php script of the PHP SDK which contains a call to the phpinfo() function.  

This vulnerability requires a misconfiguration of the server to be present so it can be exploited. For example, making the PHP application’s /vendor directory web accessible.  

The combination of the vulnerability and the server misconfiguration would allow an attacker to craft an HTTP request that executes the phpinfo() method. The attacker would then be able to get access to system information like configuration, modules, and environment variables and later on use the compromised secrets to access additional data.

### Patches

This problem has been patched in dependencies of version 2.0.1.

### Workarounds

If an immediate deployment with the updated vendor package is not available, you can perform the following temporary workarounds:
- delete the vendor/microsoft/microsoft-graph-beta/tests/GetPhpInfo.php file
- remove access to the /vendor directory will remove this vulnerability
- disable the phpinfo function

### References
For more information about the vulnerability and the patch, users can refer to the following sources: 

- https://nvd.nist.gov/vuln/detail/CVE-2023-49103
- https://github.com/microsoftgraph/msgraph-beta-sdk-php/compare/2.0.0...2.0.1 
- https://github.com/microsoftgraph/msgraph-sdk-php-core/compare/2.0.1...2.0.2 
- https://github.com/microsoftgraph/msgraph-sdk-php/compare/1.109.0...1.109.1 
- https://owncloud.com/security-advisories/disclosure-of-sensitive-credentials-and-configuration-in-containerized-deployments/

## Which versions are affected by GHSA-7mc6-x925-7qvx?

2 open source packages ship an affected version, including microsoft/microsoft-graph-beta.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `microsoft/microsoft-graph-beta` | Packagist | All versions | 2.0.1 |
| `microsoft/microsoft-graph-beta` | Packagist | All versions | 2.0.1 |

## How do I fix GHSA-7mc6-x925-7qvx?

Upgrade microsoft/microsoft-graph-beta to 2.0.1 or later.

## Is GHSA-7mc6-x925-7qvx being exploited?

There is no known exploitation of GHSA-7mc6-x925-7qvx in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-7mc6-x925-7qvx and fix it if it is affected.

What it is: GHSA-7mc6-x925-7qvx is a vulnerability in microsoft/microsoft-graph-beta, published on 5 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-7mc6-x925-7qvx in the wild and no public exploit code.

Affected packages and fixed versions:
- microsoft/microsoft-graph-beta (Packagist): affected all versions; fixed in 2.0.1
- microsoft/microsoft-graph-beta (Packagist): affected all versions; fixed in 2.0.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-7mc6-x925-7qvx/ (Markdown: https://insights.sbomify.com/GHSA-7mc6-x925-7qvx/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-7mc6-x925-7qvx

---
From sbomify Insights: https://insights.sbomify.com/GHSA-7mc6-x925-7qvx/
Summaries are generated and may contain mistakes; the official description above is the record.
