1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <!DOCTYPE policymap [
3+ <!ELEMENT policymap (policy)*>
4+ <!ATTLIST policymap xmlns CDATA #FIXED "">
5+ <!ELEMENT policy EMPTY>
6+ <!ATTLIST policy xmlns CDATA #FIXED "">
7+ <!ATTLIST policy domain NMTOKEN #REQUIRED>
8+ <!ATTLIST policy name NMTOKEN #IMPLIED>
9+ <!ATTLIST policy pattern CDATA #IMPLIED>
10+ <!ATTLIST policy rights NMTOKEN #IMPLIED>
11+ <!ATTLIST policy stealth NMTOKEN #IMPLIED>
12+ <!ATTLIST policy value CDATA #IMPLIED>
13+ ]>
14+ <!--
15+ Creating a security policy that fits your specific local environment
16+ before making use of ImageMagick is highly advised. You can find guidance on
17+ setting up this policy at https://imagemagick.org/script/security-policy.php,
18+ and it's important to verify your policy using the validation tool located
19+ at https://imagemagick-secevaluator.doyensec.com/.
20+
21+
22+ Web-safe ImageMagick security policy:
23+
24+ This security protocol designed for web-safe usage focuses on situations
25+ where ImageMagick is applied in publicly accessible contexts, like websites.
26+ It deactivates the capability to read from or write to any image formats
27+ other than web-safe formats like GIF, JPEG, and PNG. Additionally, this
28+ policy prohibits the execution of image filters and indirect reads, thereby
29+ thwarting potential security breaches. By implementing these limitations,
30+ the web-safe policy fortifies the safeguarding of systems accessible to
31+ the public, reducing the risk of exploiting ImageMagick's capabilities
32+ for potential attacks.
33+ -->
34+ <policymap >
35+ <!-- Dynamically yield the CPU relative to the system load average. -->
36+ <policy domain =" resource" name =" dynamic-throttle" value =" false" />
37+ <!-- Force memory initialization by memory mapping select memory allocations. -->
38+ <policy domain =" cache" name =" memory-map" value =" anonymous" />
39+ <!-- Ensure all image data is fully flushed and synchronized to disk. -->
40+ <policy domain =" cache" name =" synchronize" value =" true" />
41+ <!-- Do not permit any delegates to execute. -->
42+ <policy domain =" delegate" rights =" none" pattern =" *" />
43+ <!-- Do not permit any image filters to load. -->
44+ <policy domain =" filter" rights =" none" pattern =" *" />
45+ <!-- Don't read/write from/to stdin/stdout. -->
46+ <policy domain =" path" rights =" none" pattern =" -" />
47+ <!-- don't read sensitive paths. -->
48+ <policy domain =" path" rights =" none" pattern =" /etc/*" />
49+ <!-- Indirect reads are not permitted. -->
50+ <policy domain =" path" rights =" none" pattern =" @*" />
51+ <!-- Deny all image modules and specifically exempt reading or writing web-safe image formats. -->
52+ <policy domain =" module" rights =" none" pattern =" *" />
53+ <!-- Allow only web-safe image formats. -->
54+ <policy domain =" module" rights =" read | write" pattern =" {GIF,JPEG,PNG,WEBP}" />
55+ <!-- Disable PDF -->
56+ <policy domain =" coder" rights =" none" pattern =" PDF" />
57+ <!-- CVE-2016–3714 https://imagetragick.com/ -->
58+ <policy domain =" coder" rights =" none" pattern =" EPHEMERAL" />
59+ <policy domain =" coder" rights =" none" pattern =" URL" />
60+ <policy domain =" coder" rights =" none" pattern =" HTTPS" />
61+ <policy domain =" coder" rights =" none" pattern =" MVG" />
62+ <policy domain =" coder" rights =" none" pattern =" MSL" />
63+ <policy domain =" coder" rights =" none" pattern =" TEXT" />
64+ <policy domain =" coder" rights =" none" pattern =" SHOW" />
65+ <policy domain =" coder" rights =" none" pattern =" WIN" />
66+ <policy domain =" coder" rights =" none" pattern =" PLT" />
67+ </policymap >
0 commit comments