What's the valid form of Trace(ab)*Trace(ac)

You haven’t told us what the variables are. The first question is, is the expression convex or concave? if neither it can’t be used in CVX. If concave, it can’t be minimized in CVX. if convex, it can’'t be maximized in CVX.