# Small subgroup confinement attack on Diffie-Hellman: shared key is 1

I've found a post here: Small subgroup confinement attack on Diffie-Hellman which says we can pick $$k$$ in this way:

And, as we know, $$2$$ will always be a prime-factor of $$p−1$$, therefore there will be a subgroup with two elements, that don’t generate anything besides themselves. Obviously the neutral element $$1$$ is in that subgroup, the other element is $$p−1$$; In this way, can we just pick $$k = {(p-1) \over 2}$$ as $$w=2$$; then, Eva can make sure that the so called shared key must be $$1$$ or $$p-1$$?

By the way, I really do some test and I find the result of shared key is really $$1$$....

But as far as I know, DH is really a secure algorithm, so I think I must have made a mistake; can anybody tell me where I'm mistaken?