How did the pact affect the Sand Village in a way they wanted to attack the Hidden Leaf?
From the naruto wiki


   For years, Sunagakure suffered a series of budget cuts by the daimyō of the Land of Wind, weakening the village and thus re-routing ninja missions to Konoha. One day, Orochimaru, a missing-nin from Konoha who founded Otogakure, approached the Fourth Kazekage with the proposition of a joint invasion using the Chūnin Exams hosted in Konoha as a cover to attack


Hope this explains it better.