Background: In this study data of three national surveys conducted among female sex workers (FSW), prison inmates and people who inject drugs (PWID) were presented and compared in relation to knowledge, attitude, and practises. Methods: The surveys were conducted in 2009 and 2010 and included 2546 PWID, 872 FSW and 5530 prison inmates. Knowledge, attitude and practises towards HIV were measured through similar questions for each category. Results: Over 90% of all participants had ever heard of HIV/AIDS, although only approximately half of them perceived themselves at risk of contracting HIV. More than 80% were able to correctly identify the ways of preventing the sexual transmission of HIV; while more than two-thirds did not use condom in their last sexual contact. Approximately 20% of prisoners and FSW had a history of injecting drugs. Among all participants who have injected drugs, prisoners had the highest unsafe injecting behaviour at the last injection (61%), followed by FSW (11%) and PWID (3%). Conclusions: Despite major efforts to control the HIV epidemic in Iran, the level of risk and vulnerability among prisoners, FSW and PWID is still high. The level of comprehensive knowledge about HIV/AIDS is relatively good; however, their risk perception of contracting HIV is low and high-risk behaviours are prevalent. Therefore, HIV prevention programs should be redesigned in a more comprehensive way to identify the best venues to reach the largest number of people at a higher risk of contracting HIV and decrease their risk overlaps and vulnerability factors.