How to move forward to PhD with failures in masters? I had BSc + MSc in IT without thesis from my native country "A". 
I had an ambition to do PhD in CS.

So, 

First, I got enrolled in MSc in CS program in a university "X" in a country "B". I left the program as it was math-intensive. 

Second, I got enrolled in MEng in CSE program in a university "Y" in the same country "B". I left the program because I failed in consecutive semesters.

As it stands, I am weak in math, stats, and some other core CS subjects.

I am now planning to get enrolled in BSc in CS. 

Would that be a wise decision? 

What other options do I have?
Many people succeed after setbacks. But your current base from which to move forward isn't strong. Let me suggest two options. 

The first is that you reevaluate your "need" to get a doctorate. What else do you enjoy doing for which your preparation is better and the path to success shorter. I don't suggest that is best for you, but worth thinking about. 

But the other option is to take a long view. Figure out where you are weak - math, stats, and some core CS subjects. Figure out how to get the required knowledge in (most of) those and work on that, delaying but not abandoning a doctorate. Proving yourself there will help you move along, but it will also help you figure out if it is really right for you. If you wind up hating the study of the basics it will be hard to move to higher levels. 

But a doctorate is about more than just those sorts of topics. It involves research and you don't indicate whether you have any experience there, so it is hard to guess whether your desire is realistic. That is, do you have a realistic picture of what a PhD graduate actually does to succeed. If you don't have a good picture of that, you need to get one before you spend a lot of time and effort trying to reach something you may not enjoy in the end. 

(a) consider options, or (b) long path - long view.