Cookies allow a web server to maintain state over the basically stateless HTTP protocoll.
Scope of cookies
A cookie has an associated scope which defines:
the maximum amount of time in which the user agent should return the cookie,
the servers to which the user agent should return the cookie, and
the URI schemes for which the cookie is applicable.
Security concerns
For historical reasons, there are a few security concerns with cookies:
Although a server can indicate that a given cookie is intended for «secure» connections (with the Secure attribute?), it does not provide integrity in the presence of an active network attacker
Cookies for a given host are shared across all the ports on that host, even though the usual same-origin policy used by web browsers isolates content retrieved via different ports.