According to media reports, an attacker can
- upload a library to a Samba share and then
- open a named pipe whose name equals the local path to the uploaded library
to remotely execute the code contained in the library.
How does it work? Is this a "classic" buffer overflow? Or is Samba tricked into executing some legitimate library loading code? If yes, how? Is there something we, as developers, can learn from this? I have checked the usual online resources, but they mainly contain information on how to protect yourself if you are a Samba user.
Trying to find the answer, I have looked at the patch:
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -475,6 +475,11 @@ bool is_known_pipename(const char *pipename, struct ndr_syntax_id *syntax)
{
NTSTATUS status;
+ if (strchr(pipename, '/')) {
+ DEBUG(1, ("Refusing open on pipe %s\n", pipename));
+ return false;
+ }
+
if (lp_disable_spoolss() && strequal(pipename, "spoolss")) {
DEBUG(10, ("refusing spoolss access\n"));
return false;
--
But, apparently, the patch just adds additional validation and does not show the "juicy part" where the malicious library is loaded.