A crowd in Bangladesh has beaten eight pirates to death after they boarded a river boat and tried to rob passengers .