T09 · Insecure Skill Coding Practices
- Location
lib/ourgroceries/__init__.py:129- Finding
Authentication Session Cookie Exposed Through Debug Logging
- Content
View full analysis
Vulnerability Details
File Location:
lib/ourgroceries/__init__.py, lines 129–133
Vulnerability Type: Sensitive session-token exposure through application logs
Risk Level: HighVulnerable Code
python cookies = session.cookie_jar.filter_cookies(BASE_URL) for key, cookie in cookies.items(): if key == COOKIE_KEY_SESSION: self._session_key = cookie.value _LOGGER.debug('ourgroceries found _session_key {}'.format(self._session_key))Technical Analysis
After authentication, the client copies the complete
ourgroceries-authsession-cookie value into a debug log message. Session cookies are bearer credentials: possession of a valid value may be sufficient to issue authenticated requests without knowing the account password.Although the message uses the debug level, debug logging is commonly enabled during troubleshooting and may be captured by terminal logs, support bundles, CI systems, service managers, or centralized logging platforms. Logging the complete value unnecessarily expands the number of systems and users that can access the authenticated session.
Attack Path
- Debug logging is enabled for the
ourgrocerieslogger. - A user runs any operation that invokes
OurGroceries.login(). - The client authenticates and receives the
ourgroceries-authsession cookie. - The complete cookie value is written to a local or centralized log.
- An attacker with access to those logs extracts the cookie.
- The attacker supplies the cookie in requests to OurGroceries.
- If the session remains valid and the service does not enforce additional binding controls, the attacker performs operations as the affected account.
Impact Assessment
Successful exploitation may provide access equivalent to the authenticated OurGroceries session. This can expose shopping-list names, items, notes, and identifiers and may allow modification or deletion of lists and items sup ...[truncated 243 chars]
- Debug logging is enabled for the
- Remediation
View remediation
Remediation Suggestions
-
Remove the session value from all log messages.
-
Replace the vulnerable statement with a constant message:
python _LOGGER.debug("ourgroceries session established") -
Add a logging policy that explicitly prohibits passwords, cookies, authorization headers, and API tokens.
-
Review retained debug logs and support bundles for previously exposed values.
-
Invalidate active sessions if affected logs may have been accessible to unauthorized parties.
-
Add an automated test that captures log output during login and verifies that the session value is absent.
-
