This article presents a new model for valuing financial contracts subject to credit risk and collateralization. We study credit default swap (CDS) contract subject to counterparty risk. There are three credit risk factors in CDS. They are credit risks from the buyer, seller and reference entity. We show that default dependency has a significant impact on the value of CDS. We also show that a fully collateralized CDS is not equivalent to a risk-free one. In other words, full collateralization cannot eliminate counterparty risk completely in the CDS market.