-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
refresh token does not expire #6630
Comments
In the future, we'd appreciate it if you would please refrain from publicizing issues that clearly have security implications: |
This appears to be an (unaddressed) vulnerability in Django OAuth Toolkit itself: |
Thanks for finding that. |
I'm able to reproduce this: In my testing, OAuth2 refresh tokens do not respect the expiration specified in curl -sk "https://ryan:[email protected]/api/v2/settings/authentication/" | jq '.OAUTH2_PROVIDER'
{
"ACCESS_TOKEN_EXPIRE_SECONDS": 15,
"AUTHORIZATION_CODE_EXPIRE_SECONDS": 600,
"REFRESH_TOKEN_EXPIRE_SECONDS": 15
} ~ awx login --conf.username ryan --conf.password ryan --conf.client_id VQr23xzaE8qrrz7doFj3N8gAHEJR3pusVGFk40wl --conf.client_secret 9id8NqJXMjRpGMeBYCFVONB1218vpnS4jIbXLrImzXwH6aUPKR5NsmMiRlWSY7NzhAW4kx422eHdVRb5qppLdtcIPGjMLU25b2aX3IQF98U82IWwQkMiThJ6z6w0Hlru
{
"token": "R1gWIQ4z9vYqgso2Yn8ZL1NwwU0EMt",
"refresh_token": "ioDQ4gSXSu9l99HkoN4IFXDPsVecOE"
}
~ export TOWER_TOKEN=fvejfRrieTi6ESkodxJvQ74LpSYS7w
~ awx me | jq '.results[] | .username'
"ryan" (wait 30 seconds or so for the token to expire) ~ awx me | jq '.results[] | .username'
Valid credentials were not provided.
$ awx login --help Despite having a short-lived refresh token expiry, the refresh token allows you to create new access tokens after 15 seconds.
|
Thanks @sdwru - this change will got out in the next release of AWX. |
I have verified this works on devel using the instructions provided in the issue. |
@sdwru would you like to be acknowledged (in a CVE) for discovering and reporting this? If so, please reach out to me with the name you'd like to use for attribution (or post it here, if you're comfortable with that).
|
ISSUE TYPE
SUMMARY
Using password grant type, refresh token does not expire according to
REFRESH_TOKEN_EXPIRE_SECONDS
.ENVIRONMENT
STEPS TO REPRODUCE
Set the expiry times low from AWX GUI > Settings > System
Confirm the settings from api
Create an Application from the GUI of Authorization Grant Type
Resource owner password-based
. Save a copy of theclientId
andclientSecret
.Create the access and refresh tokens using password grant:
Which returns
Wait at least 20 seconds and try use refresh token
That previous refresh token continues to generate new
access_token
and newrefresh_token
after 20 seconds. Even after I waited 12 hours it still worked.I also tried manually adding the settings to
/etc/tower/settings.py
of the docker container.and restarting the container.
EXPECTED RESULTS
The refresh token should have failed to generate a new access token and returned an error message after more than 10 + 10 seconds.
ACTUAL RESULTS
The last refresh token still generates a new
access_token
and newrefresh_token
after 20 seconds. I waited 12 hours and the last generated refresh token still works. So it appears to ignore the refresh token expiry time.ADDITIONAL INFO
Should the refresh token stay the same each time it is used? Current behavior is that a new refresh token is generated each time it is used. The previous one no longer works. So the way it works currently, refresh tokens are one-time use only.
The text was updated successfully, but these errors were encountered: