This was originally mentioned on the Cocos2d forum here:http://www.cocos2d-iphone.org/forum/topic/28114/page/2
The grid pathfinding recipes allows for movement diagonally from one grid square to another even if there are grid walls there to block the movement. This problem is rooted in the fact that the gird is a little misleading.
The pathfinding algorithm is merely a bunch of nodes and links. The "grid" is kind of a simplification of that, but, admittedly it can lead to confusion. In that recipe each grid node is linked to all 8 other nodes around it. If you change this to link the nodes non-diagonally only (4 links per node) then this solves the problem but removes diagonal movement.
I will post updated recipe code here sometime in the next few days.