The Internet-of-Things, popularly referred to as IoT, has been gaining magnanimous attention since the last decade. More and more objects are becoming smart by the integration of sensors in them. All of these objects are interconnected by the internet to produce a variety of services. By 2025, the world is predicted to have over 27 billion devices connected by the Internet-of-Things. However, the internet was not built keeping the security of IoT in mind. This poses a multitude of security threats to IoT. With the expected expansion of the IoT network in the near future, the impact of security breaches will get more dangerous. In this survey, we analyze the biggest attacks that have impaired IoT networks in the past along with the methods which could have been employed to safeguard against such attacks. The aim of this survey is to provide comprehensive guidelines to IoT architects about the potential attack vectors that malicious attackers have exploited in the past and the various defenses that can be undertaken to nullify such attacks. This survey summarizes the lessons that real-world IoT security breaches have taught us over the years.