T09 · Insecure Skill Coding Practices
- Location
scripts/publish_article.ps1:27- Finding
WordPress credentials can be transmitted over unencrypted HTTP
- Content
View full analysis
&1 ``` From `scripts/delete_article.ps1`: ```powershell # Remove the trailing slash from the URL $SiteUrl = $SiteUrl.TrimEnd('/') # Build the API URL $ApiUrl = "$SiteUrl/wp-json/wp/v2/posts/$PostId" # Generate the authentication header $Credentials = "${Username}:${AppPassword}" $EncodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($Credentials)) Write-Host "Deleting article ID: $PostId ..." # Send a DELETE request with curl $curlArgs = @( "-X", "DELETE", $ApiUrl, "-H", "Authorization: Basic $EncodedCredentials", "-H", "Content-Type: application/json" ) ``` ### Technical Analysis Both scripts accept an arbitrary string as `SiteUrl` and append the WordPress REST API path without parsing the URL or requiring the HTTPS scheme. The resulting request includes an HTTP Basic authentication header containing the Base64-encoded username and application password. Base64 is an encoding mechanism and provides no confidentiality. If a user, compromised workflow, or misleading instruction supplies an `http://` URL, the credentia ...[truncated 1633 chars]- Remediation
View remediation
