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

Severe security vulnerability scanned by ScoutSuite on runner agent policy #368

Closed
narenaryan opened this issue Sep 9, 2021 · 14 comments
Closed
Labels
bug 🐛 Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@narenaryan
Copy link

Hi,

We are using terraform-aws-gitlab-runnner to spin up GitLab runners on our AWS account. As part of security auditing, there was a severe alert raised on this policy created by terraform module: https://github.com/npalm/terraform-aws-gitlab-runner/blob/develop/policies/instance-docker-machine-policy.json#L21

The problem lies with permitting IamPassrole action on all resources. As per Access Advisor AWS, we can confirm that this action is not being used at all.

Therefore, can we remove this action from the policy to make the infrastructure more secure? If you think it should be fine, can I give a PR for that?

@kayman-mk
Copy link
Collaborator

kayman-mk commented Sep 30, 2021

Have you tried to remove this action and see what happens?

EDIT: Did it. Let's wait >24h and some hundred jobs and check what happens.

@narenaryan
Copy link
Author

@kayman-mk, functionality-wise, nothing happened on our side. Let us confirm from your run.

@kayman-mk
Copy link
Collaborator

I'd like to try it again on monday as I updated to 4.30.0 and removed the IamPassRole. I had some troubles with the agents not being able to create the runners. Might they need this policy to pass the role to the runner (not 100% sure what this policy is good for)?

@npalm
Copy link
Collaborator

npalm commented Oct 1, 2021

From the top of my head the IAM pass role is required on the agent instance to pass the role to the docker machine instances.

@kayman-mk
Copy link
Collaborator

kayman-mk commented Oct 4, 2021

@npalm, I think so too. Had some problems to get the runners started without the iam:PassRole policy.

May be we can limit this policy to the spcific role passed to the docker machine runner instance?

@npalm
Copy link
Collaborator

npalm commented Oct 5, 2021

@kayman-mk Sounds good to me to limit the passrole as much as possible. Seems you can limit the passrole for a specif resource, see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html

@kayman-mk
Copy link
Collaborator

@narenaryan As soon as the PR gets merged, could you please recheck? At least AWS Config is not complaining about the policy. And we can't simply remove it.

@npalm npalm added good first issue Good for newcomers help wanted Extra attention is needed labels Oct 6, 2021
@kayman-mk
Copy link
Collaborator

@narenaryan Did you run your security check again? iam:PassRole has been limited to the role which is passed and no longer shows "*". This has been release with 4.31.1

@npalm
Copy link
Collaborator

npalm commented Oct 19, 2021

@narenaryan Did you had time to check the security issue?

@narenaryan
Copy link
Author

Hi @npalm, sorry for the delay, I am on vacation now. I will pass this to my team to get the role re-scanned.

@kayman-mk
Copy link
Collaborator

@narenaryan Any news here?

@kayman-mk
Copy link
Collaborator

@narenaryan Any news here or can the issue be closed?

@npalm
Copy link
Collaborator

npalm commented Aug 20, 2022

I won't be close to my laptop the next weeks, so no updates from me

@kayman-mk kayman-mk added the bug 🐛 Something isn't working label Dec 31, 2022
@kayman-mk
Copy link
Collaborator

Closed due to missing feedback. Should have been fixed some months ago.

Please reopen the issue if still valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants