I am an east asian studies major, currently working on my honors thesis in the area of Shugendo.

If anyone wants to understand how the mikkyo techniques of Buddhism developed into the kuji-in and then spread to ninjutsu, you must explore this religion.

In Japan the Shugenja/Yamabushi was a wandering mountain ascetic whose doctrine combined Shingon with shaman, daoist, and shinto techniques and beliefs for the purpose of accumulating occult power and eventually transforming into a Buddha in their current body. They developed the kuji-in, as well as being indirectly responsible for the development of Noh theater (which was derived from their meditational dance), and many other mountain practices. Also, the ideas of Honjisuijaku, allowed for the interweaving of Buddhist and Shinto cosmologies throughout Japanese religious thought, was developed and spread by these independent monks.

Their frequent use of magic to cure diseases, perform excorsisms, walk barefoot on burning coals and the edges of katana without harm, were all attributed to the power they achieved through mountian training, standing under waterfalls, fasting, canting, and performing the kuji-in.

The traditional ninjas took advantage of the commonly held belief in the kuji-in to strike fear into their enemies. Their have been attempts made by scholars to link certain ninja clans historically with groups of shugenja, but because of the gross lack of written documentation surrounding both traditions, it has been very difficult.

Hope this helps.