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.

47 lines
1.7 KiB

  1. Subject: Prevent some forms of Cross Protocol Scripting attacks
  2. Author: Andreas Fritiofson <andreas.fritiofson@gmail.com>
  3. Origin: other, http://openocd.zylin.com/#/c/4335/
  4. Bug-Debian: https://bugs.debian.org/887488
  5. Last-Update: 2018-01-18
  6. From 3a223ca3ebc7ac24d7726a0cd58e5695bc813657 Mon Sep 17 00:00:00 2001
  7. From: Andreas Fritiofson <andreas.fritiofson@gmail.com>
  8. Date: Sat, 13 Jan 2018 21:00:47 +0100
  9. Subject: [PATCH] CVE-2018-5704: Prevent some forms of Cross Protocol Scripting attacks
  10. OpenOCD can be targeted by a Cross Protocol Scripting attack from
  11. a web browser running malicious code, such as the following PoC:
  12. var x = new XMLHttpRequest();
  13. x.open("POST", "http://127.0.0.1:4444", true);
  14. x.send("exec xcalc\r\n");
  15. This mitigation should provide some protection from browser-based
  16. attacks and is based on the corresponding fix in Redis:
  17. https://github.com/antirez/redis/blob/8075572207b5aebb1385c4f233f5302544439325/src/networking.c#L1758
  18. Change-Id: Ia96ebe19b74b5805dc228bf7364c7971a90a4581
  19. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
  20. Reported-by: Josef Gajdusek <atx@atx.name>
  21. ---
  22. diff --git a/src/server/startup.tcl b/src/server/startup.tcl
  23. index 64ace40..dd1b31e 100644
  24. --- a/src/server/startup.tcl
  25. +++ b/src/server/startup.tcl
  26. @@ -8,3 +8,14 @@
  27. # one target
  28. reset halt
  29. }
  30. +
  31. +proc prevent_cps {} {
  32. + echo "Possible SECURITY ATTACK detected."
  33. + echo "It looks like somebody is sending POST or Host: commands to OpenOCD."
  34. + echo "This is likely due to an attacker attempting to use Cross Protocol Scripting"
  35. + echo "to compromise your OpenOCD instance. Connection aborted."
  36. + exit
  37. +}
  38. +
  39. +proc POST {args} { prevent_cps }
  40. +proc Host: {args} { prevent_cps }