CVE-2026-39890: PraisonAI Affected by Remote Code Execution via YAML Deserialization in Agent Definition Loading

Published Apr 8, 2026
·
Updated

Summary The AgentService.loadAgentFromFile method uses the js-yaml library to parse YAML files without disabling dangerous tags (such as !!js/function and !!js/undefined). This allows an attacker to craft a malicious YAML file that, when parsed, executes arbitrary JavaScript code. An attacker can exploit this vulnerability by uploading a malicious agent definition file via the API endpoint, leading to remote code execution (RCE) on the server.

Details The vulnerability exists in the YAML deserialization process. The js-yaml library's load function is used without specifying a safe schema (e.g., JSONSCHEMA or DEFAULTSAFESCHEMA). This enables the parsing of JavaScript functions and other dangerous types. When a malicious YAML file containing a !!js/function tag is parsed, the function is evaluated, leading to arbitrary code execution.

The vulnerable code is located in src/agents/agent.service.ts at line 55.

PoC An attacker can create a malicious agent YAML file with the following content: yaml !!js/function > function(){ require('childprocess').execSync('touch /tmp/pwned') } Then, upload this file as an agent definition via the API endpoint that uses AgentService.loadAgentFromFile. When the agent is loaded (either during startup or via an API call that triggers loading), the payload will execute the command touch /tmp/pwned, demonstrating arbitrary code execution.

Impact This vulnerability allows an unauthenticated attacker (if the API endpoint is unprotected) or an authenticated attacker with the ability to upload agent definitions to execute arbitrary code on the server. This can lead to complete compromise of the server, data theft, or further network penetration.

Recommended Fix Replace the unsafe load method with a safe alternative. Specifically, use the load method with a safe schema, such as JSONSCHEMA or DEFAULTSAFESCHEMA. For example:

typescript import yaml from 'js-yaml'; import { JSONSCHEMA } from 'js-yaml';

// In the loadAgentFromFile method const agent = yaml.load(fileContent, { schema: JSONSCHEMA });

Alternatively, if the application requires only a subset of YAML features, consider using the safeLoad method from an older version (though note it was deprecated). The key is to avoid loading tags that can execute code.

Additionally, validate and sanitize all user input, especially file uploads. Ensure that agent definition files are only uploaded by trusted users and consider storing them in a secure location with proper access controls.

Other sources

PraisonAI is a multi-agent teams system. Prior to 4.5.115, the AgentService.loadAgentFromFile method uses the js-yaml library to parse YAML files without disabling dangerous tags (such as !!js/function and !!js/undefined). This allows an attacker to craft a malicious YAML file that, when parsed, executes arbitrary JavaScript code. An attacker can exploit this vulnerability by uploading a malicious agent definition file via the API endpoint, leading to remote code execution (RCE) on the server. This vulnerability is fixed in 4.5.115.

MITRE

Affected Software

2 affected componentsFixes available
pip/praisonai<=4.5.114
4.5.115
Praison PraisonAI<=4.5.114

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/praisonai to a version that resolves this vulnerability.

    Fixed in 4.5.115
  2. Upgrade

    Upgrade PraisonAI to a version that resolves this vulnerability.

    Fixed in 4.5.115
  3. Configuration

    In src/agents/agent.service.ts (loadAgentFromFile), replace yaml.load(fileContent) with yaml.load(fileContent, { schema: JSON_SCHEMA }) to avoid loading dangerous tags such as !!js/function and !!js/undefined.

    AgentService.loadAgentFromFile (js-yaml) js-yaml load schema = { schema: JSON_SCHEMA }
  4. Compensating control

    Ensure agent definition files are only uploaded by trusted users; store agent definition files in a secure location with proper access controls.

  5. Compensating control

    Validate and sanitize all user input, especially file uploads, including the YAML agent definition files uploaded via the API endpoint.

Event History

Apr 8, 2026
Advisory Published
via GitHub·07:17 PM
Data Sourced
via GitHub·07:17 PM
DescriptionSeverityWeaknessAffected Software
CVE Published
via MITRE·08:45 PM
Data Sourced
via MITRE·08:45 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
Affected Software

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203