Attribute based key agreement protocols are kind of identity based protocols which the identities consist of descriptive attributes. Fujioka et al. in 2011 suggested an attribute based key agreement protocol resilient to ephemeral key reveal attack. In this paper, we show that the Fujioka protocol is vulnerable to key compromise impersonation (KCI) attack and consequently a secure attribute based key agreement protocol is introduced. We prove the security of our protocol in the random oracle model.