**Hardcoded Credentials Vulnerability Exposes Harbor Container Registry to Remote Attacks**

A critical security risk has been discovered in the popular open-source container registry project, GoHarbor's Harbor. The default admin password, which is set during initial deployment, can be easily exploited by remote attackers to gain full administrative access and compromise the entire registry. This vulnerability, reported by notnotnotveg, highlights the importance of securing containerized applications and emphasizes the need for regular security audits.

**Hardcoded Credentials: A Recipe for Disaster**

Harbor initializes with a default administrator account (admin) and password (Harbor12345), which is configured through the harbor_admin_password parameter in the harbor.yml file. While operators are expected to change these credentials during or after deployment, Harbor does not enforce a password change during setup or upon first login. This lack of security measure leaves the container registry vulnerable to attacks from unauthorized users. If an attacker can obtain the default admin password, they can authenticate and gain full control over the registry.

**The Risks of Unchanged Credentials**

An attacker who gains administrative access can fully compromise the Harbor registry and all managed artifacts. This includes the ability to overwrite or inject malicious container images, which can lead to remote code execution in downstream continuous integration and continuous development (CI/CD) pipelines and Kubernetes environments. Furthermore, an attacker can establish persistent access by creating new users, robot accounts, or API tokens, and weaken or disable security controls such as vulnerability scanning, signature enforcement, and role-based access controls.

In addition to these risks, administrative privileges also allow destructive actions such as deleting repositories or corrupting artifacts, resulting in service disruption and loss of system integrity. Moreover, sensitive images can be exfiltrated by configuring replication to external registries or downloading artifacts directly. These attacks not only compromise the security of the container registry but also put downstream applications at risk.

**Prevention is Better than Cure**

To prevent these risks, operators should change the default administrative password either before or immediately after deployment. This can be done through the Harbor web interface or by specifying a unique value for harbor_admin_password in harbor.yml during installation. It's essential to note that hardcoding credentials is never an acceptable practice, and developers should always prioritize security when building containerized applications.

**A Proposed Fix**

A fix has been proposed to address the hardcoded default password by removing or randomizing default credentials during installation. The Harbor team has opened a pull request (https://github.com/goharbor/harbor/pull/19188) to address this vulnerability, which is an essential step towards securing the container registry.

**Conclusion**

The hardcoded credentials vulnerability in GoHarbor's Harbor highlights the importance of security in containerized applications. It emphasizes the need for regular security audits and highlights the risks associated with unchanged default admin passwords. Operators should take immediate action to change their administrative password and ensure that their container registry is secure. By doing so, they can prevent remote attacks and protect their downstream applications from compromise.

**Recommendations**

* Change the default admin password either before or immediately after deployment. * Specify a unique value for harbor_admin_password in harbor.yml during installation. * Regularly review security settings and ensure that all security controls are enabled. * Stay up-to-date with the latest security patches and updates to prevent similar vulnerabilities.

By following these recommendations, operators can ensure that their container registry is secure and protected from remote attacks.