All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The entry of some parts of the boxer shorts inside the anus does not invalidate ablution.
The matters that invalidate ablution are confined to known issues, some of which are agreed upon and others are things over which the scholars have differed in opinion. What you mentioned is not one of them.
Allah knows best.