We have witnessed significant technological advancement over the past few years, including the Internet of Things (IoT). The IoT's ability to connect consumer appliances to the internet has changed the way we live. As a result of the significant benefits that IoT has brought to household usage, it has become a topic of discussion for research departments, leading to its expansion into industrial sectors, commonly known as the Industrial Internet of Things (IIoT). IIoT enables automation and the use of intelligent machines to improve product manufacturing processes and enhance our lives as customers. However, as IIoT-enabling technology and applications continue to grow, security issues and privacy protection challenges become harder to manage, which frequently results in data breaches and sensitive information disclosures. This paper first explains what the reader needs to know about the IIoT system architecture in Industry 4.0 to make it easier for them to understand. Second, a hacking scenario is utilized as a methodology to conduct an in-depth analysis of various security issues, as well as their impacts and countermeasures, for each level of the IIoT architecture. Additionally, our hacking scenarios present a variety of targets from which malicious actors can launch their assaults. Third, we provide a thorough review of the various blockchain solutions currently being employed to protect IIoT systems. Finally, this paper draws to a close by outlining certain gaps and potential solutions that could be investigated in subsequent studies to strengthen security and enhance privacy for IIoT systems.