As far as i'm aware, legally, giving attribution attribution in exchange for a thing has been held to be plenty consideration since nearly the dawn of time.
(Even giving up the right to sue for warranty claims would likely be sufficient consideration, but no open source license explicitly says that, they just disclaim there are warranties, which is not quite the same)
There are some that are significantly more problematic. WTFPL is a good example of a maybe-gratuitous license.
Common ones have clear consideration (agreements to do certain things with your patent rights for downstream users, etc).
I have not yet found anyone who believes you would have a strong argument that most open source licenses are gratuitous.
Agreement to do a thing you didn't have to do (give attribution, include a copy of a license, whatever) in exchange for something, is plenty consideration.