Societies are complex systems which tend to polarize into sub-groups of individuals with dramatically opposite perspectives. This phenomenon is reflected -- and often amplified -- in online social networks where, however, humans are no more the only players, and co-exist alongside with social bots, i.e. software-controlled accounts. Analyzing large-scale social data collected during the Catalan referendum for independence on October 1 2017, consisting of nearly 4 millions Twitter posts generated by almost 1 million users, we identify the two polarized groups of Independentists and Constitutionalists and quantify the structural and emotional roles played by social bots. We show that bots act from peripheral areas of the social system to target influential humans of both groups, mostly bombarding Independentists with negative and violent contents, sustaining and inflating instability in this online society. These results quantify the potential dangerous influence of political bots during voting processes.