OpenHarmony, a modern operating system developed by OpenAtom Foundation, has been found to contain multiple path traversal vulnerabilities in its appspawn and nwebspawn services. These vulnerabilities allow attackers to create arbitrary directories or to escape the application sandbox. CVE-2022-43451 highlights the findings in OpenHarmony-v3.1.2 and prior versions. Root privileges, if obtained, would give malicious actors full control of the system. It's crucial to understand and apply appropriate patches to mitigate the risks associated with this vulnerability. In this post, we'll delve into the details of the vulnerability, code snippets, and ways to address the security flaw effectively.

A Brief Overview of the Vulnerability

The multiple path traversal vulnerabilities (CVE-2022-43451) in OpenHarmony are manifested through appspawn and nwebspawn services. By exploiting these vulnerabilities, local attackers can create arbitrary directories or escape the application sandbox. If chained with other vulnerabilities, this security flaw can lead to unprivileged processes gaining full root access.

Code Snippet

Take a look at this code snippet showing the issue in appspawn, leading to an insecure directory creation:

std::string GetAppDataPath(const std::string &bundleName)
    std::string appDataPath;
    if (!realpath(("/data/" + bundleName).c_str(), appDataPath)) {
        return "";

    return appDataPath;

In the code snippet above, the GetAppDataPath function does not properly validate the user input, leading to the directory creation vulnerability. The bundleName variable, which represents the user-controlled input, could contain relative or absolute paths that would lead to insecure paths.

Exploit Details

To exploit this vulnerability, a local attacker could create a specially crafted bundle name containing directory traversal sequences. By doing so, the attacker could potentially create arbitrary directories or escape the application sandbox. Following is an example of a directory traversal exploit payload:


In this payload, ../../../../../../../../../tmp/evil_app effectively escapes the '/data' directory and creates the 'evil_app' directory in the '/tmp' directory. By chaining the vulnerability with other flaws, the attacker can elevate privileges to root.

Original References

The OpenHarmony project has officially acknowledged this vulnerability. For more information and updates, please refer to the official links below:

1. OpenHarmony Security Advisory:
2. CVE-2022-43451:

How to Mitigate the Risk

To prevent exploitation of this vulnerability, it's essential to apply the patches provided by the OpenHarmony project for affected versions. It's also crucial to restrict unprivileged access and compartmentalize software components to minimize the potential damage of a successful exploit.

Closing Thoughts

The CVE-2022-43451 vulnerability found in OpenHarmony-v3.1.2 and prior versions showcases the importance of regular security audits and timely patches. Organizations and users leveraging OpenHarmony should ensure that they have all the necessary safeguards in place to protect their systems against threats arising from this security flaw. By staying informed and proactive, you can prevent unauthorized access to your systems and maintain a secure environment.


Published on: 11/03/2022 20:15:00 UTC
Last modified on: 11/07/2022 02:16:00 UTC