Credit default swaps (CDSs) are thought to ease borrowing by protecting lenders against default. This paper develops a model of the demand for CDS when borrowers choose the riskiness of investment and verification is imperfect. The model shows that CDSs may lead to risk-shifting, increasing the probability of default. Our model provides new insights on the role of CDS during the recent financial crisis. JEL Classification Numbers: G33, D86, D61.