Conversation
|
This pull request reveals multiple security findings in the Helm chart and CI/CD workflow, including potential information disclosure through logs and error messages, a Server-Side Template Injection vulnerability, insecure image usage settings, and weak random password generation, which could expose internal infrastructure details and create opportunities for reconnaissance or unauthorized access.
Information Disclosure in CI/CD Logs in
|
| Vulnerability | Information Disclosure in CI/CD Logs |
|---|---|
| Description | The CI/CD workflow in .github/workflows/k8s-tests.yml is being modified to include kubectl logs, kubectl get events, and kubectl describe pvc. These commands output operational data, cluster topology, and application logs into the GitHub Actions logs. If the repository is public, these logs are also public, leading to information disclosure of internal infrastructure details and potentially sensitive application data. |
django-DefectDojo/.github/workflows/k8s-tests.yml
Lines 98 to 106 in 91c17c3
Server-Side Template Injection (SSTI) in helm/defectdojo/charts/postgresql/charts/common/templates/_tplvalues.tpl
| Vulnerability | Server-Side Template Injection (SSTI) |
|---|---|
| Description | The common.tplvalues.render helper function, used in various parts of the Helm chart including common.labels.matchLabels and common.images.renderPullSecrets, directly processes user-supplied input from values.yaml (e.g., .Values.podLabels, .Values.global.imagePullSecrets) using the tpl function. This allows an attacker to inject arbitrary Go template syntax, leading to Server-Side Template Injection. |
Information Disclosure via Error Messages in helm/defectdojo/charts/postgresql/charts/common/templates/_errors.tpl
| Vulnerability | Information Disclosure via Error Messages |
|---|---|
| Description | The Helm chart's error messages for missing passwords disclose the Kubernetes secret names and the specific key names within those secrets. This information is generated by the common.validations.values.single.empty and common.utils.secret.getvalue templates, which are called by common.errors.upgrade.passwords.empty. The error message also provides a kubectl get secret command that explicitly includes the secret name and field name. |
Potential for Insecure Image Usage Bypass in helm/defectdojo/charts/postgresql/charts/common/templates/_errors.tpl
| Vulnerability | Potential for Insecure Image Usage Bypass |
|---|---|
| Description | The global.security.allowInsecureImages flag is set to true by default in the helm/defectdojo/charts/postgresql/values.yaml file. This setting, when active, downgrades the common.errors.insecureImages template's behavior from a deployment-blocking error to a warning if non-standard or unverified container images are used for the PostgreSQL component. This weakens the supply chain security posture by allowing potentially vulnerable or malicious PostgreSQL images to be deployed without a hard stop, relying solely on a warning that could be overlooked. |
Information Disclosure via Warning/Error Messages (Image Verification) in helm/defectdojo/charts/postgresql/charts/common/templates/_errors.tpl
| Vulnerability | Information Disclosure via Warning/Error Messages (Image Verification) |
|---|---|
| Description | The Helm chart's common.errors.insecureImages template is designed to warn or error when non-standard container images are used. While this is a security feature, the detailed messages it generates, particularly when global.security.allowInsecureImages is false, include the full registry, repository, and tag of both the expected and the 'unrecognized' or 'retagged' images. This level of detail could potentially aid an attacker in reconnaissance by revealing internal image naming conventions, private registry paths, and specific versioning strategies, even if the images themselves are not directly accessible. |
Insecure Random Number Generation for Password Generation in helm/defectdojo/charts/postgresql/charts/common/templates/_secrets.tpl
| Vulnerability | Insecure Random Number Generation for Password Generation |
|---|---|
| Description | The common.secrets.passwords.manage template, defined in helm/defectdojo/charts/postgresql/charts/common/templates/_secrets.tpl, uses randAlphaNum and randAscii functions for password generation. These functions, part of the Sprig library used by Helm, are based on Go's math/rand package, which is not cryptographically secure. This can lead to predictable passwords for database users or other components if users rely on the default password generation, making them vulnerable to brute-force attacks. |
All finding details can be found in the DryRun Security Dashboard.
kiblik
left a comment
There was a problem hiding this comment.
Minor issues but some possible improvements
There was a problem hiding this comment.
Is this file needed? If all deps are included, this might be removed.
| dependencies: | ||
| - name: postgresql | ||
| version: ~16.7.0 | ||
| repository: "https://charts.bitnami.com/bitnami" | ||
| version: 16.7.26 | ||
| condition: postgresql.enabled | ||
| - name: redis | ||
| version: ~19.6.0 | ||
| repository: "https://charts.bitnami.com/bitnami" | ||
| version: 19.6.4 | ||
| condition: redis.enabled |
There was a problem hiding this comment.
Is this section needed? If all deps are included, this might be removed.
There was a problem hiding this comment.
Is this file needed? If base dep is included, this might be removed.
| dependencies: | ||
| - name: common | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| tags: | ||
| - bitnami-common | ||
| version: 2.x.x |
There was a problem hiding this comment.
Is this section needed? If base dep is included, this might be removed.
There was a problem hiding this comment.
Is this file needed? If base dep is included, this might be removed.
| dependencies: | ||
| - name: common | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| tags: | ||
| - bitnami-common | ||
| version: 2.x.x |
There was a problem hiding this comment.
Is this section needed? If base dep is included, this might be removed.
|
@kiblik Moving over to this PR. I found that it was turning into a yak-shave trying to have the charts in the repo. |
|
New PR: #13063 |
Description
Vendoring the bitnami charts and images. This is a temporary change until we can identify and test a better solution. A public repo has been setup to hold the images.
Test results
The changes made to the charts were in values.yaml. Ex:
https://github.com/DefectDojo/django-DefectDojo/compare/bugfix...ree/vendor_bitnami?expand=1#diff-b14ee6d8b279a42c87a5f60470bfd6ed367a58c6222e37eef94ba07749e140f6R123
There was also a change in values.yaml to allow insecure images.
Other than that, these charts are identical to the ones on bitnami today. I chose to post the charts uncompressed as best practice and for transparency.