T09 · Insecure Skill Coding Practices
Error
- Location
- owncloud.json:2
- Finding
- Hardcoded Shared Credentials Expose the OwnCloud File Inventory Service## Vulnerability Details **File Location**: `owncloud.json:2-4`; `allfiles-service/allfiles.service.txt:7-8` **Vulnerability Type**: Hardcoded credentials and insecure secret storage **Risk Level**: High ### Vulnerable Code `owncloud.json:2-4`: ```json "ALLFILES_URL": "https://xxxx.xxx:8443/allfiles", "ALLFILES_USER": "admin", "ALLFILES_PASS": "SuperSecretPasswordChangeMe2026!", ``` `allfiles-service/allfiles.service.txt:7-8`: ```ini Environment="ALLFILES_USER=admin" Environment="ALLFILES_PASS=SuperSecretPasswordChangeMe2026!" ``` ### Technical Analysis The project includes the same static username and password in both the client configuration and the systemd service definition. The service uses these values for HTTP Basic Authentication. Although traffic is protected by TLS, TLS does not mitigate disclosure of credentials stored in source-controlled or locally readable files. The documentation instructs administrators to configure matching values, which increases the likelihood that the supplied credentials will be deployed without modification. Static credentials in a systemd unit may also be visible to users who can read the unit file or inspect deployment artifacts. The authenticated endpoint returns the generated OwnCloud filename and modification-time inventory. Filenames can contain sensitive information such as customer names, project identifiers, medical subjects, financial records, or internal document titles. ### Attack Path 1. An attacker obtains a copy of the project, a deployment archive, `owncloud.json`, or the installed systemd unit. 2. The attacker extracts the supplied username and password. 3. The attacker identifies the externally or internally reachable endpoint on TCP port 8443. 4. The attacker sends an authenticated request such as: ```bash curl --proto '=https' \ -u 'admin:SuperSecretPasswordChangeMe2026!' \ 'https://target.example:8443/allfiles' ``` ...[truncated 807 chars]
- Remediation
- ## Remediation Suggestions 1. Remove all real or usable credentials from tracked configuration and service files. 2. Replace committed values with clearly invalid placeholders and reject known placeholder values during startup. 3. Generate a unique, high-entropy password for every deployment. 4. Store server credentials using systemd credentials, for example `LoadCredential=`, rather than inline `Environment=` directives. 5. Alternatively, use a root-owned environment file with permissions set to `0600`, while ensuring the service only receives the specific secret it needs. 6. Protect `owncloud.json` with restrictive ownership and mode `0600`. 7. Rotate the published password in every existing deployment. 8. Restrict port 8443 using a host firewall, VPN, reverse-proxy access policy, or IP allowlist. 9. Consider replacing Basic Authentication with short-lived tokens or mutual TLS. 10. Add authentication failure rate limiting and audit logging without logging credentials.
