Bad undergraduate grades, decent research experience, what are the chances of PhD admits? I'm an undergraduate student in Electronics and Electrical Engineering but am more interested in research in computer science and have decent research experience. I have done a summer internship at a very reputed place in France and our work during the summer was published and we also won Distinguished artefact award at the conference. I'm now writing my thesis at a prominent computer science research institute in Germany with a senior researcher and now am thinking about pursuing PhD. But I don't exactly have good grades and people have suggested to go for a masters to improve my academics but I feel like its the same issue there as well, isn't it the same case for masters? I need good grades to get accepted for a decent masters program so I don't see how it helps me.

I would really appreciate the community's help and advice on how best to proceed for this.
I am writing as a American about American universities in case you want to apply here.

A Master's Degree is basically a "halfway" step toward a PhD. That is, it requires two years instead of four (or more) after an undergraduate degree.

As such, a Master's degree represents a lower risk for a university. In your case, they're dealing with a student that has a weak academic record and a strong work record. They are also, potentially, dealing with a "late bloomer."

So the feeling at a Master's Program might be, "let's see if this strong worker can fix his academic record. If he can, that's great, and he can go on to a PhD. If he has the same problems in his Master's work as in his undergraduate work, that's two years, not four that were wasted. (One year, if you are asked to leave the Master's program.)