0001-fixed-possible-RCE-vulnerability-unset-escape-variable.patch 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. From 410a6ce5c80dd981c22752da034f2529b5eee844 Mon Sep 17 00:00:00 2001
  2. From: sebres <serg.brester@sebres.de>
  3. Date: Mon, 21 Jun 2021 17:12:53 +0200
  4. Subject: [PATCH] fixed possible RCE vulnerability, unset escape variable
  5. (default tilde) stops consider "~" char after new-line as composing escape
  6. sequence
  7. [Retrieved from:
  8. https://github.com/fail2ban/fail2ban/commit/410a6ce5c80dd981c22752da034f2529b5eee844]
  9. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  10. ---
  11. config/action.d/complain.conf | 2 +-
  12. config/action.d/dshield.conf | 2 +-
  13. config/action.d/mail-buffered.conf | 8 ++++----
  14. config/action.d/mail-whois-lines.conf | 2 +-
  15. config/action.d/mail-whois.conf | 6 +++---
  16. config/action.d/mail.conf | 6 +++---
  17. 6 files changed, 13 insertions(+), 13 deletions(-)
  18. diff --git a/config/action.d/complain.conf b/config/action.d/complain.conf
  19. index 3a5f882c9f..4d73b05859 100644
  20. --- a/config/action.d/complain.conf
  21. +++ b/config/action.d/complain.conf
  22. @@ -102,7 +102,7 @@ logpath = /dev/null
  23. # Notes.: Your system mail command. Is passed 2 args: subject and recipient
  24. # Values: CMD
  25. #
  26. -mailcmd = mail -s
  27. +mailcmd = mail -E 'set escape' -s
  28. # Option: mailargs
  29. # Notes.: Additional arguments to mail command. e.g. for standard Unix mail:
  30. diff --git a/config/action.d/dshield.conf b/config/action.d/dshield.conf
  31. index c128bef348..3d5a7a53a9 100644
  32. --- a/config/action.d/dshield.conf
  33. +++ b/config/action.d/dshield.conf
  34. @@ -179,7 +179,7 @@ tcpflags =
  35. # Notes.: Your system mail command. Is passed 2 args: subject and recipient
  36. # Values: CMD
  37. #
  38. -mailcmd = mail -s
  39. +mailcmd = mail -E 'set escape' -s
  40. # Option: mailargs
  41. # Notes.: Additional arguments to mail command. e.g. for standard Unix mail:
  42. diff --git a/config/action.d/mail-buffered.conf b/config/action.d/mail-buffered.conf
  43. index 325f185b2f..79b841049c 100644
  44. --- a/config/action.d/mail-buffered.conf
  45. +++ b/config/action.d/mail-buffered.conf
  46. @@ -17,7 +17,7 @@ actionstart = printf %%b "Hi,\n
  47. The jail <name> has been started successfully.\n
  48. Output will be buffered until <lines> lines are available.\n
  49. Regards,\n
  50. - Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  51. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  52. # Option: actionstop
  53. # Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
  54. @@ -28,13 +28,13 @@ actionstop = if [ -f <tmpfile> ]; then
  55. These hosts have been banned by Fail2Ban.\n
  56. `cat <tmpfile>`
  57. Regards,\n
  58. - Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary from <fq-hostname>" <dest>
  59. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: Summary from <fq-hostname>" <dest>
  60. rm <tmpfile>
  61. fi
  62. printf %%b "Hi,\n
  63. The jail <name> has been stopped.\n
  64. Regards,\n
  65. - Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  66. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  67. # Option: actioncheck
  68. # Notes.: command executed once before each actionban command
  69. @@ -55,7 +55,7 @@ actionban = printf %%b "`date`: <ip> (<failures> failures)\n" >> <tmpfile>
  70. These hosts have been banned by Fail2Ban.\n
  71. `cat <tmpfile>`
  72. \nRegards,\n
  73. - Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary" <dest>
  74. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: Summary" <dest>
  75. rm <tmpfile>
  76. fi
  77. diff --git a/config/action.d/mail-whois-lines.conf b/config/action.d/mail-whois-lines.conf
  78. index 3a3e56b2c7..d2818cb9b9 100644
  79. --- a/config/action.d/mail-whois-lines.conf
  80. +++ b/config/action.d/mail-whois-lines.conf
  81. @@ -72,7 +72,7 @@ actionunban =
  82. # Notes.: Your system mail command. Is passed 2 args: subject and recipient
  83. # Values: CMD
  84. #
  85. -mailcmd = mail -s
  86. +mailcmd = mail -E 'set escape' -s
  87. # Default name of the chain
  88. #
  89. diff --git a/config/action.d/mail-whois.conf b/config/action.d/mail-whois.conf
  90. index 7fea34c40d..ab33b616dc 100644
  91. --- a/config/action.d/mail-whois.conf
  92. +++ b/config/action.d/mail-whois.conf
  93. @@ -20,7 +20,7 @@ norestored = 1
  94. actionstart = printf %%b "Hi,\n
  95. The jail <name> has been started successfully.\n
  96. Regards,\n
  97. - Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  98. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  99. # Option: actionstop
  100. # Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
  101. @@ -29,7 +29,7 @@ actionstart = printf %%b "Hi,\n
  102. actionstop = printf %%b "Hi,\n
  103. The jail <name> has been stopped.\n
  104. Regards,\n
  105. - Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  106. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  107. # Option: actioncheck
  108. # Notes.: command executed once before each actionban command
  109. @@ -49,7 +49,7 @@ actionban = printf %%b "Hi,\n
  110. Here is more information about <ip> :\n
  111. `%(_whois_command)s`\n
  112. Regards,\n
  113. - Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  114. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  115. # Option: actionunban
  116. # Notes.: command executed when unbanning an IP. Take care that the
  117. diff --git a/config/action.d/mail.conf b/config/action.d/mail.conf
  118. index 5d8c0e154c..f4838ddcb6 100644
  119. --- a/config/action.d/mail.conf
  120. +++ b/config/action.d/mail.conf
  121. @@ -16,7 +16,7 @@ norestored = 1
  122. actionstart = printf %%b "Hi,\n
  123. The jail <name> has been started successfully.\n
  124. Regards,\n
  125. - Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  126. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  127. # Option: actionstop
  128. # Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
  129. @@ -25,7 +25,7 @@ actionstart = printf %%b "Hi,\n
  130. actionstop = printf %%b "Hi,\n
  131. The jail <name> has been stopped.\n
  132. Regards,\n
  133. - Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  134. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  135. # Option: actioncheck
  136. # Notes.: command executed once before each actionban command
  137. @@ -43,7 +43,7 @@ actionban = printf %%b "Hi,\n
  138. The IP <ip> has just been banned by Fail2Ban after
  139. <failures> attempts against <name>.\n
  140. Regards,\n
  141. - Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  142. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  143. # Option: actionunban
  144. # Notes.: command executed when unbanning an IP. Take care that the