Descrizione
GoCD is a continuous deliver server. From 13.3.0 until 26.1.0, GoCD does not correctly encode and escape malicious material modification comments that mimic the special trackback format used by package materials when rendering the Stage Detail, Job/Build Detail, Value Stream Map, and Pipeline History views. A user with write access to a material tracked by GoCD can store arbitrary HTML or JavaScript in a forged package material comment, which executes in the browser session of a user who later views an affected page. Exploitation requires a victim to view a page that renders the malicious modification, and GoCD does not render every material comment in every view. Successful exploitation can expose a privileged user session or allow changes using the victim's credentials and privileges. This issue is fixed in version 26.1.0.
Tipo di vulnerabilità
CWE-80
Cross-Site Scripting di base: tag HTML di script non neutralizzati
Il prodotto non neutralizza, o neutralizza in modo errato, caratteri speciali come <, > e & che possono essere interpretati come elementi di script dalla pagina web che li riceve.
Impatto sui sistemi
| Ambito | Impatto |
| Riservatezza, Integrità, Disponibilità |
Leggere i dati dell’applicazione, Eseguire codice o comandi non autorizzati |
Come si previene
Sviluppo
Carefully check each input parameter against a rigorous positive specification (allowlist) defining the specific characters and format allowed. All input should be neutralized, not just parameters that the user is supposed to specify, but all data in the request, including hidden fields, cookies, headers, the URL itself, and so forth. A common mistake that leads to continuing XSS vulnerabilities is to validate only fields that are expected to be redisplayed by the site. We often encounter data from the request that is reflected by the application server or the application that the development team did not anticipate. Also, a field that is not currently reflected may be used by a future developer. Therefore, validating ALL parts of the HTTP request is recommended.
Sviluppo · Codifica dell’output
Specifica una codifica dei caratteri (per esempio UTF-8) che il componente che legge l’output sappia gestire. Se la codifica non è indicata, quel componente può sceglierne un’altra, per impostazione predefinita o deducendola in modo errato; quando le codifiche non coincidono, alcune sequenze di caratteri possono diventare «speciali» pur non essendolo nell’originale, e un attaccante può sfruttare la differenza per attacchi di injection o per aggirare le protezioni. Il problema è frequente nelle pagine web: se la codifica non è indicata nell’intestazione HTTP, i browser tendono a indovinarla, aprendo la strada ad attacchi XSS sottili.
Sviluppo
Con Struts, scrivi tutti i dati provenienti dai form bean con l’attributo filter del bean impostato a true.
Sviluppo · Riduzione della superficie di attacco
Per limitare gli attacchi XSS contro il cookie di sessione, impostalo come HttpOnly: nei browser che lo supportano impedisce agli script malevoli di leggerlo tramite document.cookie. Non è una soluzione completa, perché non tutti i browser lo supportano e perché XmlHttpRequest e altre tecnologie del browser permettono comunque di leggere le intestazioni HTTP, compresa quella Set-Cookie in cui è impostato HttpOnly.
Tutte le 383 CVE di tipo CWE-80, con andamento e prevenzione