The king can't pass through a square that is under attack and in your case he doesn't, rook can do it (here is is passing through b2 attacked by bishop). So everything is according to rules.
Illegal move or bug?
Neither. That move is perfectly legal. The king was not in check, the king did not castle into check, and the king did not castle through check. Lol.
The rule is that if a King moves THROUGH a square that is being attacked, which the king did not do. Perfectly legal
I have understood that castling is not allowed in chess if any square between King and rook is threatened. Check out move 12 of this game for white. Is it a bug or hack? My opponent disconnected himself for 2-3 minutes before that move and dc'd 2 more times in the game.
http://www.chess.com/livechess/game?id=581865201