T09 · Insecure Skill Coding Practices
- Location
scripts/query_ragflow.py:18- Finding
Hardcoded reusable credentials and user queries transmitted over plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/query_ragflow.py, lines 18-20 and 68-80
Vulnerability Type: Hardcoded secrets and plaintext transmission of sensitive data
Risk Level: HighVulnerable Code
python API_URL = "http://172.28.20.46:30001/v1/conversation/completion" AUTHORIZATION = "IjQxYThhZGYyMDZlYjExZjFhZDE1ODJkYzljOWQ1YmJmIg.aYvfEw.ElppYHks0F5ETowUlvqA1Th-XHE" COOKIE = "session=.elxVyzOegCAMAMC_dHagCgh8hIDaRleQyfh3jYmD4w13Qh5dWt4ZEizixBmNxgsbKkbknKkcxcy43siB/MyNqkb5CONuTR2yyWQKbarxVe7a9dNywRHnEaYvfEw66dir-0J0wYtii0IOGJ11861RtRtxp4"python headers = { "Authorization": AUTHORIZATION, "Content-Type": "application/json", "Cookie": COOKIE } response = requests.post( API_URL, json=payload, headers=headers, stream=True, timeout=120 )Technical Analysis
The source code contains a reusable authorization token and session cookie. Anyone with read access to the Skill package, source archive, logs containing the source, or a copied installation can recover and reuse these credentials.
The endpoint uses
http://rather than HTTPS. The authorization token, session cookie, and the complete user question inpayloadare therefore transmitted without transport encryption or server authentication. A network-positioned attacker can observe or modify the request and streamed response.Sending user questions to RAGFlow is necessary for the declared functionality, but embedding reusable credentials and using plaintext HTTP exceed the minimum security exposure required to perform that function.
Attack Path
- An attacker obtains read access to the Skill package or intercepts traffic on the path to
172.28.20.46:30001. - The attacker extracts the hardcoded authorization token and session cookie from the source or plaintext request headers.
- The attacker submits requests to the RAGFlow API under the compromised session.
- I ...[truncated 754 chars]
- An attacker obtains read access to the Skill package or intercepts traffic on the path to
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed authorization token and session cookie.
- Remove all credentials from the repository and its retained history.
- Load credentials from environment variables or an approved secret manager:
python import os API_URL = os.environ["RAGFLOW_API_URL"] AUTHORIZATION = os.environ["RAGFLOW_AUTHORIZATION"] COOKIE = os.environ["RAGFLOW_SESSION_COOKIE"] - Require an
https://endpoint and retain certificate verification. Do not suppress TLS verification. - Replace browser session cookies with a purpose-specific, least-privilege API credential where supported.
- Use short-lived, revocable credentials scoped only to the required knowledge base and query operation.
- Add secret scanning to CI and prevent credentials from being committed.
- Clearly notify users that their questions are sent to an external RAGFlow service, and avoid submitting secrets or unrelated private data.
