Closed debug-ito closed 3 years ago
OK, I just tested it.
Using this policy,
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"arn:aws:iot:*:*:client/${iot:Connection.Thing.ThingName}"
]
}
AWS IoT now accepted connection from a device if and only if it used the correct client ID.
@debug-ito, thank you for reporting and filing this. I've updated the policy document and given the policy a more unique name.
Thanks!
The
registration_helper.py
in the Blinky-Hello-World example creates a AWS IoT Policy (named "Default") like the following.This policy is insecure. This policy allows a client to use ANY client ID. As a result, a device can publish messages impersonating other devices, and it can eavesdrop messages for other devices.
See also: https://docs.aws.amazon.com/iot/latest/developerguide/security-best-practices.html#secure-mqtt
Although I didn't test it, a solution would be to use
${iot:Connection.Thing.ThingName}
for the resource to allowiot:Connect
action, as described in the above link. The Thing Name is bound to the client certificate, so it would force a device to use its own client ID only.