Let's say my cell phone is hacked by somebody and that I have no knowledge that my cell phone has been hacked. My cell phone is connected to a WiFi network A.
Can hackers hack into the WiFi network A through my cell phone in this case?
Let's say my cell phone is hacked by somebody and that I have no knowledge that my cell phone has been hacked. My cell phone is connected to a WiFi network A.
Can hackers hack into the WiFi network A through my cell phone in this case?
If an attacker has full access to your cell phone, chances are, they can read the Wi-Fi password in plain text and thus get access to your Wi-Fi network.
The exact specifics depend on the OS, the version, etc...
Modern cell phones are small computers, sharing much of the same software (e.g. Android phones run on the Linux kernel), so I feel they should be treated no different than a regular computer, with the exception that they more commonly have multiple network interfaces such as WiFi and mobile network.
If a computer is compromised, an attacker can certainly use that access to attack whatever network the computer is connected to, regardless of the medium.
Also, the other answers discuss how a compromised phone could allow the network's WiFi PSK to be used by the attacker. This isn't very useful for a remotely compromised phone. Also, this will require root access, while a malicious app has enough privilege to launch attacks on your network.
WiFi passwords are stored in wpa_supplicant.conf
Meaning that if someone hacked your Android phone in a way that allows him to get access to your file (And such an exploit existed, such as ES File Explorer last year, or a RAT) it doesn't even need to wait for you to connect to a WiFi, he can just read the files.
And that can be done automatically (For instance, with the ES File Explorer exploit, you could connect a Raspberry Pi to a Public Wifi and make a script that looked for the exploit and retrieve the wanted file)
It's usually located in /system/etc/wifi/
or /data/misc/wifi
Finding your wifi password is superfluous and fairly irrelevant. If they have full access to your phone and your phone is connected to your wifi, they don't need your wifi password at all.
An attacker with full administrative rights on your device can send, receive, and sniff traffic to your wifi router and all other users on your network without connecting to the wifi themselves and without using your wifi password.
They do not need to be in range of your wifi if they have remote access to your phone. They can launch any attack on your network resources directly from your phone, remotely.
As others have answered, the main threat, in terms of accessing your wifi network, is that the hacker could retrieve your wifi network credentials from your phone.
If they are located far away from where the Wifi network is, can they still access the network by using the password?
As for this follow up question from the OP, note that the fact that the cell phone has cellular wireless network capability has nothing to do with connecting to your wifi network. So the hacker cannot just dial in somehow through the cellular network connection from far away to connect to your wifi network by using the password.