Research after the bachelor's degree has ended but before applying to Master's program
Contact the professor and ask (politely!).

Nobody ever explained to me how you applied for a doctorate until after I found out my undergrad results and people started suggesting I should think about it, so I approached a few of the departmental lecturers whose work I liked, explained that I was interested in working with them and asked if there was any way I could get experience in their group. One of them turned out to have some short-term funding and paid for me to work with the group for a year as long as I did two days a week of general group jobs. During the year I was able to get to know the group, contribute to papers and apply for doctoral funding (which was successful).

So, from personal experience of being in a similar situation, it's worth asking. This took place in the UK about (ahem) 20 years ago, but unpaid or self-funded 'placements' are common in other countries too. Since you have a clear aim (a specific project or area that you want to strengthen your CV in, for a defined period) and it doesn't sound like there is a specific structure in place to facilitate this, then I'd give it a go.