You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
6.2 KiB

  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. ---
  8. config/action.d/complain.conf | 2 +-
  9. config/action.d/dshield.conf | 2 +-
  10. config/action.d/mail-buffered.conf | 8 ++++----
  11. config/action.d/mail-whois-lines.conf | 2 +-
  12. config/action.d/mail-whois.conf | 6 +++---
  13. config/action.d/mail.conf | 6 +++---
  14. 6 files changed, 13 insertions(+), 13 deletions(-)
  15. --- a/config/action.d/complain.conf
  16. +++ b/config/action.d/complain.conf
  17. @@ -102,7 +102,7 @@ logpath = /dev/null
  18. # Notes.: Your system mail command. Is passed 2 args: subject and recipient
  19. # Values: CMD
  20. #
  21. -mailcmd = mail -s
  22. +mailcmd = mail -E 'set escape' -s
  23. # Option: mailargs
  24. # Notes.: Additional arguments to mail command. e.g. for standard Unix mail:
  25. --- a/config/action.d/dshield.conf
  26. +++ b/config/action.d/dshield.conf
  27. @@ -179,7 +179,7 @@ tcpflags =
  28. # Notes.: Your system mail command. Is passed 2 args: subject and recipient
  29. # Values: CMD
  30. #
  31. -mailcmd = mail -s
  32. +mailcmd = mail -E 'set escape' -s
  33. # Option: mailargs
  34. # Notes.: Additional arguments to mail command. e.g. for standard Unix mail:
  35. --- a/config/action.d/mail-buffered.conf
  36. +++ b/config/action.d/mail-buffered.conf
  37. @@ -17,7 +17,7 @@ actionstart = printf %%b "Hi,\n
  38. The jail <name> has been started successfully.\n
  39. Output will be buffered until <lines> lines are available.\n
  40. Regards,\n
  41. - Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  42. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  43. # Option: actionstop
  44. # Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
  45. @@ -28,13 +28,13 @@ actionstop = if [ -f <tmpfile> ]; then
  46. These hosts have been banned by Fail2Ban.\n
  47. `cat <tmpfile>`
  48. Regards,\n
  49. - Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary from <fq-hostname>" <dest>
  50. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: Summary from <fq-hostname>" <dest>
  51. rm <tmpfile>
  52. fi
  53. printf %%b "Hi,\n
  54. The jail <name> has been stopped.\n
  55. Regards,\n
  56. - Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  57. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  58. # Option: actioncheck
  59. # Notes.: command executed once before each actionban command
  60. @@ -55,7 +55,7 @@ actionban = printf %%b "`date`: <ip> (<f
  61. These hosts have been banned by Fail2Ban.\n
  62. `cat <tmpfile>`
  63. \nRegards,\n
  64. - Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary" <dest>
  65. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: Summary" <dest>
  66. rm <tmpfile>
  67. fi
  68. --- a/config/action.d/mail-whois-lines.conf
  69. +++ b/config/action.d/mail-whois-lines.conf
  70. @@ -72,7 +72,7 @@ actionunban =
  71. # Notes.: Your system mail command. Is passed 2 args: subject and recipient
  72. # Values: CMD
  73. #
  74. -mailcmd = mail -s
  75. +mailcmd = mail -E 'set escape' -s
  76. # Default name of the chain
  77. #
  78. --- a/config/action.d/mail-whois.conf
  79. +++ b/config/action.d/mail-whois.conf
  80. @@ -20,7 +20,7 @@ norestored = 1
  81. actionstart = printf %%b "Hi,\n
  82. The jail <name> has been started successfully.\n
  83. Regards,\n
  84. - Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  85. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  86. # Option: actionstop
  87. # Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
  88. @@ -29,7 +29,7 @@ actionstart = printf %%b "Hi,\n
  89. actionstop = printf %%b "Hi,\n
  90. The jail <name> has been stopped.\n
  91. Regards,\n
  92. - Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  93. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  94. # Option: actioncheck
  95. # Notes.: command executed once before each actionban command
  96. @@ -49,7 +49,7 @@ actionban = printf %%b "Hi,\n
  97. Here is more information about <ip> :\n
  98. `%(_whois_command)s`\n
  99. Regards,\n
  100. - Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  101. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  102. # Option: actionunban
  103. # Notes.: command executed when unbanning an IP. Take care that the
  104. --- a/config/action.d/mail.conf
  105. +++ b/config/action.d/mail.conf
  106. @@ -16,7 +16,7 @@ norestored = 1
  107. actionstart = printf %%b "Hi,\n
  108. The jail <name> has been started successfully.\n
  109. Regards,\n
  110. - Fail2Ban"|mail -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  111. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: started on <fq-hostname>" <dest>
  112. # Option: actionstop
  113. # Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
  114. @@ -25,7 +25,7 @@ actionstart = printf %%b "Hi,\n
  115. actionstop = printf %%b "Hi,\n
  116. The jail <name> has been stopped.\n
  117. Regards,\n
  118. - Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  119. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: stopped on <fq-hostname>" <dest>
  120. # Option: actioncheck
  121. # Notes.: command executed once before each actionban command
  122. @@ -43,7 +43,7 @@ actionban = printf %%b "Hi,\n
  123. The IP <ip> has just been banned by Fail2Ban after
  124. <failures> attempts against <name>.\n
  125. Regards,\n
  126. - Fail2Ban"|mail -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  127. + Fail2Ban"|mail -E 'set escape' -s "[Fail2Ban] <name>: banned <ip> from <fq-hostname>" <dest>
  128. # Option: actionunban
  129. # Notes.: command executed when unbanning an IP. Take care that the