Executive brief
Dify, an AI application development platform, was found to use hardcoded default credentials for its internal PostgreSQL database within its standard Docker deployment configuration. If the database port is exposed to the internet, an attacker could use these known credentials to gain full access to the database. This could result in the theft of sensitive application data, unauthorized modification of information, or potential service disruption.
Technical details
Dify versions up to and including 1.5.1 utilize hardcoded default credentials (username and password) for PostgreSQL within the `docker-compose.yaml` and `docker-compose-template.yaml` files. In versions prior to 1.0.1, the Docker configuration also explicitly exposed PostgreSQL on TCP port 5432 to all network interfaces (0.0.0.0) by default. An unauthenticated remote attacker can connect to the database using these default credentials if the port is reachable. Successful exploitation allows for full database compromise, including data exfiltration and potential remote code execution on the container. While version 1.0.1 removed the default port exposure, the hardcoded credentials remained in subsequent versions through 1.5.1, requiring manual rotation by users.
Affected products
- LangGenius Dify up to and including 1.5.1
Timeline
- 2025-03-08: disclosed: Issue regarding default port exposure reported on GitHub
- 2025-03-10: patched: Port exposure removed in version 1.0.1; credentials remained hardcoded
- 2025-12-18: advisory: CVE-2025-56157 published
References
- https://gist.github.com/Cristliu/216ddbadaf3258498c93d408683ecabd
- https://gist.github.com/Cristliu/298f51cbc72c45d91632cd0d65aa8161
- https://github.com/langgenius/dify
- https://github.com/langgenius/dify/issues/15285
- https://github.com/langgenius/dify/pull/15286
- https://github.com/langgenius/dify/pull/15286.diff
- https://github.com/langgenius/dify/releases/tag/1.0.1