Shadow Move
Shadow Move
is in the address space of the source process so Shadow- space to set up the sharing of a socket with the ShadowMove
Move cannot directly operate on it, but ShadowMove can process. To inject code into the victim application, we create
directly use the duplicate handle (e.g., Handle 1’) because a launcher that would run the victim application as a child
it is created in the context of ShadowMove. Next, Shad- process and then leverage ptrace to inject code, in the form
owMove invokes WSADuplicateSocket to share Handle of a shared library. Finally, we put the launcher version ahead
1’ with itself. As a result, Handle 2 is created and put in of the original victim application in the command search path,
the dwProviderReserved field of the WSAPROTOCOL_INFO such that the user would invoke our launcher when he/she
structure. Finally, ShadowMove invokes WSASocket with intends to run the victim application.
the WSAPROTOCOL_INFO structure as one parameter, in order
We should note that the use of process injection can jeopar-
to make Handle 2 a functional socket handle. Here since
dize the stealthiness of the ShadowMove attack on Linux,
WSADuplicateSocket and WSASocket are invoked in the
compared with ShadowMove on Windows. However, our
same process (i.e., ShadowMove), there is no need to pass
Linux design still has a good chance of evading state-of-the-
WSAPROTOCOL_INFO structure across processes.
art defenses. We defer a detailed discussion to the evaluation
3.4.3 Socket Duplication on Linux (Section 5).
Our design of socket duplication on Linux (or *NIX in Socket sharing on Linux. To share a socket, two processes
general) is different from its Windows counterpart. Due to first connect via a Unix domain socket, then the sender pro-
a stricter process isolation, it is not possible to duplicate a cess invokes sendmsg and passes the socket descriptor in the
socket from another process directly, even if the other pro- input parameter, while the receiver invokes recvmsg and re-
cess is owned by the same user. However, socket sharing is trieves a (possibly different) socket descriptor from the output
supported on Linux, but it requires cooperation between the parameter. When a socket descriptor is passed this way, the
two processes. Since ShadowMove assumes that the victim underlying Linux kernel creates a new descriptor in the receiv-
application is not cooperative, our solution is to force the vic- ing process’ address space that refers to the same file table
tim application to cooperate by injecting code into its address entry within the kernel as the descriptor that was sent by the
[3] Yama linux security module. https://www.kernel.org [17] Video Clip for the SQLShadowMove Demo. http://
/doc/Documentation/security/Yama.txt. Accessed June 54.36.162.222/ShadowMoveDemo/SQLShadow
2019. Move.gif, 2019.
[4] Calling external program on application server. [18] Adam Blaszczyk. Can we stop detecting mimikatz
https://answers.sap.com/questions/7641883/calling- please? http://www.hexacorn.com/blog/2019/02/03/can-
external-program-on-application-server.html, 2010. we-stop-detecting-mimikatz-please/, 2019. Accessed
Accessed August 2019. Feb 2019.
[19] Adam Boileau. Trust Transience: Post Intrusion SSH
[5] List of ftp commands. https://en.wikipedia.org /wik-
Hijacking. In BlackHat Briefings, August 2005.
i/List_of_FTP_commands, 2018. Accessed February
2019. [20] Thanh Bui, Siddharth Prakash Rao, Markku Antikainen,
Viswanathan Manihatty Bojan, and Tuomas Aura. Man-
[6] Video Clip for the FTPShadowMove. http://54.36.162. in-the-machine: Exploiting ill-secured communication
222/ShadowMoveDemo/FTPShadowMove.gif, 2018. inside the computer. In 27th USENIX Security Sympo-
sium (USENIX Security 18), pages 1511–1525, Balti-
[7] A Comprehensive Open Source Security Platform.
more, MD, 2018. USENIX Association.
https://wazuh.com/product/, 2019. Accessed October
2019. [21] Microsoft Windows Dev Center. Protecting Anti-
Malware Services. https://docs.microsoft.com/en-
[8] Install npm packages globally with- us/windows/desktop/services/protecting-anti-malware-
out sudo on macOS and Linux. services-, 2018. Accessed August 2019.
https://github.com/sindresorhus/guides/blob/master/npm-
global-without-sudo.md, 2019. Accessed October [22] Ping Chen, Lieven Desmet, and Christophe Huygens. A
2019. study on advanced persistent threats. In Bart De Decker
and André Zúquete, editors, Communications and Mul-
[9] OpenSSH/Cookbook/Multiplexing. timedia Security, pages 63–72, Berlin, Heidelberg, 2014.
https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multi Springer Berlin Heidelberg.
plexing, 2019. Accessed October 2019.
[23] Weiteng Chen and Zhiyun Qian. Off-path TCP exploit:
[10] OSSEC: The World’s Most Widely Used How wireless routers can jeopardize your secrets. In
Host-based Intrusion Detection System. 27th USENIX Security Symposium (USENIX Security
https://github.com/ossec/ossec-hids, 2019. Accessed 18), pages 1581–1598, Baltimore, MD, 2018. USENIX
October 2019. Association.
[26] John Dunagan, Alice X. Zheng, and Daniel R. Simon. [38] S. Metcalf. Unofficial guide to mimikatz & command
Heat-ray: Combating identity snowball attacks using reference. https://adsecurity.org/?page_id=1821, 2018.
machine learning, combinatorial optimization and attack Accessed February 2019.
graphs. In Proceedings of the ACM SIGOPS 22Nd
Symposium on Operating Systems Principles, SOSP ’09, [39] Microsoft. Windows Remote Manage-
pages 305–320, New York, NY, USA, 2009. ACM. ment. https://docs.microsoft.com/en-
us/windows/desktop/WinRM/portal. Accessed
[27] James Forshaw. Injecting Code into Win- November 2018.
dows Protected Processes using COM - Part 1.
https://googleprojectzero.blogspot.com/2018/10/injecting- [40] Microsoft. Duplicatehandle func-
code-into-windows-protected.html, October 2018. tion. https://msdn.microsoft.com/en-
Accessed August 2019. us/library/windows/desktop/ms724251(v=vs.85).aspx,
2017. [Online; accessed 10-May-2018].
[28] Nalani Fraser, Jacqueline O’Leary, Vincent
Cannon, and Fred Plan. Apt38: Details [41] Microsoft. Wsaduplicatesocket func-
on new north korean regime-backed threat tion. https://msdn.microsoft.com/en-
group. https://www.fireeye.com/blog/threat- us/library/windows/desktop/ms741565(v=vs.85).aspx,
research/2018/10/apt38-details-on-new-north-korean- 2017. [Online; accessed 10-May-2018].
regime-backed-threat-group.html, 2017. [42] Microsoft. Mib_tcprow2 struc-
[29] Steve Friedl. An Illustrated Guide to SSH Agent For- ture. https://docs.microsoft.com/en-
warding. http://www.unixwiz.net/techtips/ssh-agent- us/windows/desktop/api/tcpmib/ns-tcpmib-
forwarding.html, 2006. Accessed October 2019. _mib_tcprow2, 2018. Accessed February 2019.
[30] gaffe23. Linux inject. https://github.com/gaffe23/linux- [43] Doug Miller, Ron Alford, Andy Applebaum, Henry Fos-
inject, 2016. Accessed July 2019. ter, Caleb Little, and Blake Strom. Automated adver-
sary emulation: A case for planning and acting with
[31] Tal Garfinkel and Mendel Rosenblum. A virtual ma- unknowns. 2018.
chine introspection based architecture for intrusion de-
tection. In Proceedings of Network and Distributed [44] MSDN. [MS-TDS]: Tabular Data Stream
Systems Security Symposium (NDSS), February 2003. Protocol. https://msdn.microsoft.com/en-
us/library/dd304523.aspx, 2018. Accessed November
[32] M. Haardt and M. Coleman. ptrace(2) Linux 2018.
Programmer’s Manual. http://man7.org/linux/man-
pages/man2/ptrace.2.html, 1999. Accessed August [45] MSDN. [MS-TDS]: SQL Batch Client
2019. Request. https://msdn.microsoft.com/en-
us/library/dd304416.aspx, 2019. Accessed November
[33] Support Home. Clearing the Windows Temp Folders. 2018.
http://lexisnexis.custhelp.com/app/answers/answer_view/
a_id/1084415/. Accessed August 2019. [46] Mark O’Neill, Scott Heidbrink, Jordan Whitehead, Tan-
ner Perdue, Luke Dickinson, Torstein Collett, Nick Bon-
[34] CrowdStrike Inc. CrowdStrike Compromise Assess- ner, Kent Seamons, and Daniel Zappala. The secure
ment Data Sheet. https://www.crowdstrike.com/wp- socket API: TLS as an operating system service. In
content/brochures/CrowdStrike_CompromiseAssessment 27th USENIX Security Symposium (USENIX Security
_DataSheet.pdf, 2019. Accessed February 2019. 18), pages 799–816, Baltimore, MD, 2018. USENIX
Association.
[35] A. D. Kent and L. M. Liebrock. Differentiating user au-
thentication graphs. In 2013 IEEE Security and Privacy [47] Pradeep Padala. Playing with ptrace, part i. Linux
Workshops, pages 72–75, May 2013. Journal, 2002(103):5–, November 2002.
[50] Neil J. Rubenking. The Best A Prepare the Environment for WinRM Hi-
Antivirus Protection for 2019.
https://www.pcmag.com/article2/0,2817,2372364,00.asp,
jacking
2019. [Online; accessed 04-February-2019]. A.1 Server Configuration
First, we configure the WinRM server on the remote ma-
[51] Hossein Siadati and Nasir Memon. Detecting struc-
chine by following these steps.
turally anomalous logins within enterprise networks. In
Proceedings of the 2017 ACM SIGSAC Conference on Set the default WinRM configuration
Computer and Communications Security, pages 1273– winrm quickconfig
1284. ACM, 2017.
Run the following command to check whether a listener is
[52] Abraham Silberschatz, Peter B. Galvin, and Greg Gagne. running, and verify the default ports
Operating System Concepts. Wiley Publishing, 9th edi-
tion, 2012. winrm e winrm/config/listener
[53] SolarWinds. SITE FTP command. Run the following command to enable basic authentication
https://support.solarwinds.com/SuccessCenter/s/article/
SITE-FTP-command, 2017. Accessed August 2019. winrm set winrm/config/service/auth
’@{Basic="true"}’
[54] W. Richard Stevens, Bill Fenner, and Andrew M. Rudoff.
UNIX Network Programming, Vol. 1. Pearson Education, Run the following command to allow transfer of unen-
3 edition, 2003. crypted data by the WinRM server