PHP default_charset is none

OWASP 2013-A5 OWASP 2017-A6 OWASP 2021-A5 WASC-13

The newer PHP versions from version 5.6 have set default_Charest as UTF-8. There are many servers using PHP default charset as empty. The default character encoding is used for encoding and decoding HTML entities, HTML special character functions. The value of default_charset will also be used to set the default character set for iconv functions encoding and decoding. Setting default_charset to an empty value is not recommended. This encoding affects htmlentities(), html_entity_decode() and htmlspecialchars(). This is also used for iconv functions too.


Using this vulnerability, an attacker can:-

  • manipulate HTTP server-side settings.

Mitigation / Precaution

Beagle recommends the following fixes:-

  • Try to use UTF-8 in charset declarations.
  • Make sure the web application is using a whitelist of accepted charsets if the application wants to control the charset.

Latest Articles