T09 · Insecure Skill Coding Practices
- Location
govb_fetcher/fetcher.py:32- Finding
Authentication Credentials Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
govb_fetcher/fetcher.py:32-64,govb_fetcher/fetcher.py:100-104
Vulnerability Type: Cleartext transmission of sensitive authentication data
Risk Level: HighVulnerable Code
python BASE_URL = 'http://zbcg-bjzc.zhongcy.com/gt-jy-toubiao/api' DETAIL_BASE = 'http://zbcg-bjzc.zhongcy.com/bjczj-jy-toubiao/index.html' HNZC_LIST_URL = 'http://www.ccgp-hunan.gov.cn/mvc/getNoticeList4Web.do' HNZC_DETAIL_URL = 'http://www.ccgp-hunan.gov.cn/mvc/viewNoticeContent.do' HNZC_PAGE_URL = 'http://www.ccgp-hunan.gov.cn/page/notice/notice.jsp' def _build_session() -> requests.Session: session = requests.Session() proxies = get_proxies() if proxies: session.proxies.update(proxies) session.cookies.update({ 'YGCG_TBSESSION': get_bjzc_tbsession(), 'JSESSIONID': get_bjzc_jsessionid(), 'jcloud_alb_route': get_bjzc_alb_route(), }) session.headers.update({ 'Accept': 'application/json, text/plain, */*', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-CN,zh;q=0.9', 'Authorization': f'Bearer {get_bjzc_bearer_token()}', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded', 'Origin': 'http://zbcg-bjzc.zhongcy.com', 'Pragma': 'no-cache', 'Referer': 'http://zbcg-bjzc.zhongcy.com/bjczj-jy-toubiao/index.html', 'User-Agent': ( 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' 'AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/146.0.0.0 Safari/537.36' ), 'contentType': 'formType', }) return sessionpython def _fetch_bjzc_page(session: requests.Session, page: int, rows: int = 100) -> dict: url = f'{BASE_URL}/cggg/gonggao/queryZBGongGaoList.do' data = { 'ggName' ...[truncated 2173 chars]- Remediation
View remediation
Remediation Suggestions
- Replace all authenticated Beijing API and page endpoints with verified
https://endpoints. - Confirm that the upstream service presents a valid certificate for the expected hostname and retain certificate verification.
- Explicitly reject redirects from HTTPS to HTTP before credentials can be forwarded.
- Avoid placing the authorization header on a broadly reusable session if it could contact another origin. Add credentials only to requests whose scheme and hostname exactly match an allowlist.
- If the upstream service genuinely offers no HTTPS support, do not send reusable credentials directly over the public network. Require an authenticated, trusted tunnel or a secure gateway under the user's control and display a clear security warning.
- Rotate the Bearer token and session cookies after deploying the fix, because previously transmitted credentials may have been observed.
- Replace all authenticated Beijing API and page endpoints with verified
