As well as having muscles that attach from the lower leg bones to the upper leg bone, the knee joint has muscles that run from the two shin bones upwards to the corner points of the hip bones. The knee joint also has muscles that run from the femur down to the the calcaneus or heel bone.
As such the knees can be affected by the foot, and in particular the heel and and also by the hip. Put another way, muscle problems within the foot or hip can affect the knee and vice versa.
The thigh consists of a single bone, the femur. The lower leg consists of two bones, the tibia and the fibula. The tibia is the larger of these two bones and connects directly to the femur at the knee joint. The fibula is smaller and non-weight bearing and is positioned to the outside of the tibia. It has some slight ability to move relative to the tibia, mainly sliding up and down.
When the knee is bent the lower leg can rotate relative to the thigh. This is why in poses like hero the foot can move to the outside of the thigh and why in bent knee poses like lotus or janu sirsasana c the foot can move towards the inside of the thigh.
When the knee is straight, the lower leg and thigh tend to rotate together as one unit. That being said, the shin may still have some ability to rotate relative to the thigh when the knee is straight.
The rotational ability of the knee might account for, in part, the triple head design of the vastus muscles. The outer and inner vastus muscles (vastus lateralis and vastus medialis) may help to control shin rotation and stabilize it.
In terms of rotating the shin relative to the thigh, posterior thigh and lateral hip muscles that attach to the fibula and outer edge of the tibia are generally responsible for rotating the shin outwards while posterior thigh and medial hip muscles are generally responsible for rotating the shin inwards.
Exceptions to these are the tensor fascia latae and sartorius.
Tensor fascia latae is an outer thigh muscle that can be used to internally rotate the shin.
Sartorius is an inner thigh muscle that can be used to externally rotate the shin and thigh bone when the knee is straight.
In straight leg standing on one leg positions, focusing on the standing leg, the knee rotators may work against each other and the quadriceps to help stabilize the knee.
Three muscles that cross the hip joint and attach to the inner edge of the tibia are the sartorius, gracilis and biceps femoris long head. Each of these muscles attaches to a prominent landmark of the pelvis. The sartorius attaches to the ASIC, the gracilis attaches near the pubic bone and the semi-tendinosus to the ischial tuberosity.
(The gracilis attaches to the ischiopuboramus near the pubic bone.)
Depending on the amount of bend in the hip, either of these muscles can come into play to internally rotate the shin or to stabilize it against external rotation.
Another muscle that attaches to the inner edge of the tibia, just below the knee, is the popliteus. The bulk of this muscle is located on the lower leg side of the knee. It's tendon crosses the back of the knee to attach to the outside of the thigh just above the knee joint.
Unlike the other three muscles, this is a single joint muscle. It only works on the knee joint. It may be important in helping to regulate joint capsule tension. The other three muscles attach further away from the joint capsule and so in this regard may be less important.
One other muscle that attaches to the inner aspect of the tibia is the semimembranosus. This muscle, like the popliteus, attaches close to the knee joint capsule. Relative to the other muscles, particularly semitendinosus, it is also positioned closer to the bone. So it too may be important in regulating joint capsule tension (and thus fluid pressure within the joint.)
Three muscles that cross the hip joint and attach to the outside of the lower leg are the biceps femoris long head, some fibers of the gluteus maximus and the tensor fasciae latae.
These latter two muscles attach to the tibia via the iliotibial tract. The former muscle attaches to the fibula.
As with internal rotation, depending on the amount of bend in the hip, either the gluteus maximus or the tensor fasciae latae can come into play to help externally rotate the shin relative to the thigh.
From a rotationally stable knee joint that is supporting the weight of the body, these five shin rotating muscles (glute max, TFL, Sartorius, Gracilis, semi-tendinosus) could be used to help control pelvic positioning relative to the thigh.
If the leg is free but the knee is stable and strong (and particularly if the knee is straight), then the TFL and Sartorius may be used as accessory hip flexor muscles.
A single joint muscle that attaches to the outside of the lower leg is the biceps femoris short head. This muscle attaches to most of the length of the back of the femur, stopping just short of an attachment point for the gluteus maximus. (Some fibers of the gluteus maximus attach directly to the thigh while others attach to the iliotibial tract. It may be worth thinking of these as separate muscles.) This muscle blends with the long head prior to inserting into the fibula.
Working from the heel upwards, the soleus muscle attaches from the calcanus or heel bone to the tibia and fibula. When active it can create a downwards pull on the fibula, stabilizing it against an upwards pull, say from either of the two biceps femoris muscles.
The gastrocnemius attaches from the heel to the thigh just above the knee joint. It's twin tendons pass between those of the hamstring muscles before attaching to the femur. When the knee is straight, the tendons of the hamstrings and gastrocnemius press against each other so that both become more tense.
So calf control (and heel control) may be an important consideration when working on knee strength, particularly in straight leg positions.
Of the single joint muscles above the knee, the biceps femoris short head is perhaps the most critical, particularly when stabilizing the knee. If it has problems, the biceps femoris long head, glute max or tensor fascia latae may stand in for it which could lead to hip stability and hip control problems.
The sartorius can also be important for knee stability. While it rotates the thigh outwards, because of it's s-shaped path near the knee, it also causes an internal rotation force on the tibia. And so it may actually work against (or better put, in coordination with) the short head of the biceps femoris to stabilize the knee against rotation.
Although it doesn't work on the knee joint, the adductor magnus long head may also be important when dealing with some types of knee pain. It attaches to the inside of the femur just above the knee joint. It may play a role in stabilizing the femur against rotation by helping to create an internal rotation force on the femur. This may provide resistance for external hip rotators to work against thus making the femur more stable rotationally. This in turn can provide an anchor from which the biceps femoris short head can activate.
For myself the left biceps femoris short head has been problematic. It may have led to hamstring pain in seated forward bends (particularly in left leg straight asymmetrical forward bends where I'm trying to lift my hands). And it may be one of the causes of hip pain in standing forward bends with the left leg forwards (triangle or front triangle) or one leg balance poses on the left leg.
Comparing my left leg to my right I notice an absence of tension at the outer back of the thigh and the outer rear hamstring tendon. Trying to adjust hip position while trying to activate this muscle helps a little but it feels more forced. And so even as I write this one possibility is to make sure that the heel is stable (while standing), make sure the outer gastrocnemius is active, then work at activating the biceps femoris short head.