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